Suppose that $n$ people are each randomly assigned a number from $1$ to $m$ with replacement.  What is the probability that exactly one number is assigned to more than one person?  

What I have tried:

Defining the event $A$ to be 'exactly one number is assigned to more than one person', I can see that the probability of $A$ is $0$ when $m=n$ and $1$ when $m<n$.
For $m>n$, the sample space would be $m^n$. I have written out the sample space for $n=3$ and $m=4$. In this case, $P(A)=40/64=5/8$. However, I cannot see how to compute the number of sample points in the general case.