Let there be $M$ (distinguishable) boxes and $N$ balls, which we uniformly distribute among the boxes. For $k \leq N$, let $g_k: \Omega \rightarrow \mathbb{Z}$ be the function counting the number of boxes yielding exactly $k$ balls. Note that I am a bit reluctant to specify $\Omega$ (Distinguish the boxes or not?) as it seems key to me to find a clever way to sort the events in it.
What would be the expectation value of $g_k$ then?
In real life probability the balls and boxes will be distinguishable to get equally probable events (though perhaps not in sub-atomic physics).
You can calculate $E[g_k]$ using the binomial distribution and linearity of expectation: take the probability of the first box having $k$ out of $N$ balls and multiply by the number of boxes.
So $\displaystyle E[g_k] = {N \choose k} \frac{(M-1)^{N-k}}{M^{N-1}}.$