The Stirling numbers of the second kind $\def\st{\genfrac\{\}0{}}\st nk$ count the number of ways to partition a set of $n$ distinct values into $k$ nonempty subsets. Taking those $n$ objects to be the $n$ positions in a word, and the subsets those that will receive the same letter, we see that with an alphabet of $x$ letters we can make
$$
\st nk\,x^{\underline k}\stackrel{\rm def}=\st nk\,x(x-1)\ldots(x-k+1)=\st nk\binom xkk!
$$
different words of length $n$ that use exactly $k$ different letters: once our partition into subsets chosen, we have $x$ choices for the letter to attached to the first subset, $x-1$ choices for the second subset, and so forth.
Note that $\sum_{k=0}^n\st nk\,x^{\underline k}=x^n$ is a well known relation, and in our application expresses the fact that each of the $x^n$ words of length$~n$ contributes to the term for exactly one vale of$~k$, its number of different letters.
In terms of the names used in the question, take $n=K$, $k=D$, and $x=A$.
There are many ways to compute the Stirling numbers of the second kind efficiently, but no simple multiplicative formula as for the binomial coefficients. If you need to go up to $n=100$ then you certainly need big integers to store them; to compute them I would personally just use the additive recursion
$$
\st{n+1}k=\st n{k-1}+k\st nk
$$
which computes them using $O(n^2)$ small multiplications and additions.
Consider for example the first term $(4)(26)(25)^3$. There are is more than one interpretation of the $25^3$. Perhaps the $25^3$ is motivated by "once we have chosen the double, say aa, and where it is, the remaining $3$ slots can be filled in $25^3$ ways with non-a's." Under this interpretation of the $25^3$, we are double-counting some possibilities and failing to count some possibilities.
It double-counts, for example, the word aabbx, and many others.
It fails to count the word aaxay, and many others.
But there is another interpretation of the $25^3$. We are say constructing a word that starts with aa. Then if we want to avoid further doubles, we have $25$ choices for the next letter, and for each choice we have $25$ choices for the next letter, and so on.
This does count aabab, which is good. But it fails to count aabbx. So it is not surprising that we get an undercount. It would be interesting to count the double-double words, and address the same issue with strings of type aaabb. With some care, one should get a correct count.
Best Answer
There is no simple closed formula for this (I think no known closed formula at all), but one can give a formula as a sum by using inclusion-exclusion.
First consider such orderings where the pairs of identical letters are distinguishable. Then $\displaystyle \sum_{k=0}^n (-1)^k2^k(2n-k)!\binom{n}{k}$ gives the number of such such orderings by inclusion-exclusion (there are $(2n-k)!$ ways for $k$ given pairs to be together (by merging the those pairs into single elements) and the rest arbitrarily ordered, $2^k$ ways to order within those given pairs, and $\binom{n}{k}$ ways to pick those $k$ pairs). By dividing by $2^n$ to eliminate the ordering of pairs of identical elements we can obtain the formula $\displaystyle \frac{1}{2^n}\sum_{k=0}^n (-1)^k2^k(2n-k)!\binom{n}{k}$.