I found a solution to my problem in this thread: How can I (algorithmically) count the number of ways n m-sided dice can add up to a given number?
But unfotunately I don't understand the last step.
$$x^n(1-x^{m})^{n}\left(\sum_{k=0}^{\infty} {n+k-1 \choose k} x^k\right)$$
I wrote it like this:
$$\left[\,\sum_{r = 0}^{n}\left(-1\right)^{r}{n \choose r}x^{mr+n}\,\right] \left[\,\sum_{k = 0}^{\infty}{n + k - 1 \choose k} x^{k}\,\right]$$
I don't why this follows:
$$\sum_{rm+k=S-n} {n \choose r} {n+k-1 \choose k} (-1)^{r}$$
And what does mean $rm+k=S-n$ in that sum. What is the upper limit?
Thanks in advance!