We can obtain a messy expression for the answer as follows. If there is no restriction of the $k_i\ge 1$ kind, the sum is $m^n$. Now we deal with the $k_i\ge 1$ restriction by using the Principle of Inclusion/Exclusion.
There are $(m-1)^n$ functions that "miss" $1$, and $(m-1)^n$ that miss $2$, and so on up to $m$. So we need to subtract $\binom{m}{1}(m-1)^n$.
But we have subtracted too much, since for every $i,j$, with $i\ne j$, we have subtracted twice the functions that "miss" $i$ and $j$. So we must add back $\binom{m}{2}(m-2)^n$.
However, we have added back too many times for the functions that miss $i$, $j$, and $k$. And so on. So we get the expression
$$m^n-\binom{m}{1}(m-1)^n +\binom{m}{2}(m-2)^n -\binom{m}{3}(m-3)^n +\cdots.$$
For details, and much more, please look at Stirling Numbers of the Second Kind. A great deal is known, but there is no pleasant closed form.
$x^{20}$ should be $x^{17}$ in your question.
$$(x+x^2+\cdots+x^{17})^{4}$$
$$=(x+x^2+\cdots+x^{17})\times (x+x^2+\cdots+x^{17})\times (x+x^2+\cdots+x^{17})\times (x+x^2+\cdots+x^{17})$$
So, you choose $x^A, x^B, x^C, x^D$ from each $()$ from the left to the right.
Then, what you need is the number of a set $(A,B,C,D)$ such that
$$A+B+C+D=17\ \text{and}\ A,B,C,D\ge 1$$
Note that the latter is already satisfied.
Each represents the number of oranges which a child get. Then, imagine when you find the coefficient of $x^{17}$. You'll choose every pattern of $(A,B,C,D)$ such that $A+B+C+D=17$.
Hence, the coefficient of $x^{17}$ represents the ways you can distribute the oranges. I hope this is helpful.
Best Answer
Here is an easy method using multinomial coefficients. Put $x=1$ to get the sum of all the coefficients. Now, we want to evaluate $\sum_{i=0}^na_i$, then we will subtract that from sum of all coefficients. Observe that these coefficients will remain unaltered even in the following expansion (because the additional terms do not contribute to powers less than $x^{n+1}$): $$(x+2x^2+3x^3+...)^2 = x^2(1+2x+3x^2+...)^2$$ $$ = x^2\Bigg(\frac{1}{(1-x)^2}\Bigg)^2$$ $$ = \frac{x^2}{(1-x)^4}$$ $$ = x^2\sum_{m=0}^\infty\binom{m+4-1}{4-1}x^m$$ Now, apply the identity that $$\sum_{i=k}^n\binom{i}{k} = \binom{n+1}{k+1}$$ and you are done.
Hope it helps:)