I used the following technique for calculating the number of integral solutions of the following equation $$\sum_{i=1}^n x_i=m,\ 0\le x_i\le k,\ k,m \in \mathbb{Z}_+ $$
The method is the following:
The number of solutions is given by the coefficient of $x^m$ in the expansion of $(1+x+x^2+\cdots+x^k)^n$ which is the coefficient of $x^m$ in the expansion of $(1-x^{k+1})^{n}(1-x)^{-n}$ and thus is given by $$\sum_{l=0}^{\lfloor m/(k+1)\rfloor}(-1)^l\binom{n}{l}\binom{n+m-(k+1)l-1}{n-1}$$
But when I tried to solve an exercise problem using this method it did not work out, though I could not find a problem in this method. I came up with this method (though I do not know if it is already there in the literature) drawing analogy to the method we use to solve similar equations with unrestricted solutions, only with positivity condition. I checked that this method also correctly gives the required no. of solutions in that case which is the well known expression $\binom{n+m-1}{n-1}$.
So it would be very kind if someone can check if the method is correct. Thanks in advance.