Assigning $m$ balls to $n$ buckets - recursive algorithm I came across the following problem and the answer to that problem:

Given $m$ balls and $n$ bins, find out how many ways to assign the balls to the bins. Notice the bins have no order: for example, $(1,2,3)$ and $(3,2,1)$ are considered the same.
As an example, if $m = 3$ and $n = 2$, you should return 2, since there are two possibilities: $(1,2)$ and $(3,0)$.

Here is a recurrence which seems to work:
$$
f(m,n) =
\begin{cases}
1 &amp; \text{if } m = 0 \text{ or } n = 1 \\
f(m,m) &amp; \text{if } n &gt; m \\
f(m,n-1) + f(m-n, n) &amp; \text{if } 1 &lt; n \leq m
\end{cases}
$$
This solution seem to work. However I don't understand how $f(m,n-1) + f(m-n,n)$ works. Why is it considering $m-n$ balls into $n$ bins?
An assignment of balls into $n$ bins falls into either one of the following two cases.


Every bin has as last one ball. So let us assign one ball to each bin first. What remains to do is to assign the remaining balls to the bins. 
Otherwise. That is, there is at least one bin that has no ball. This case is the same as assigning all balls into $n-1$ bins.


Exercise. Verify that we are counting without duplicates and without missing assignment.