From A First Course in Probability, 8th Ed - Sheldon Ross.
My solution:
$$ \frac{{n \choose m} m! (N-1)^{(n-m)}}{N^n}$$
My reasoning is that if we take the denominator to be $N^n$, it seems we're taking an ordered approach, and so the numerator should follow suit.
If we choose m of the n balls to be in the first compartment, then we have ${n \choose m} m!$ ordered choices.
The other balls can be in any other compartment. There are N-1 choices of comparment and (n-m) balls left, so that's where the other term comes from.
However, the solution is: