Formula for number of surjective functions in case where codomain is greater than domain We were deriving the formula for number of surjective functions from f: $X \to Y$, where $|X| = n$ and $|Y| = m$. The formula that we have is:
$$\sum_{k=0}^m(-1)^k (m-k)^n {m \choose k}$$
Now, if $m>n$ we have no surjective functions, as codomain is greater than domain and the answer should be zero. The formula gives the right answer, but I cannot figure out why does it work algebraically.
Any hints on why does this sum equals to zero when $m > n$?

We have
$$\begin{align*}
\sum_{k=0}^m (-1)^k (m-k)^n {m\choose k}
&= n! [z^n] \sum_{k=0}^m (-1)^k \exp((m-k)z) {m\choose k}\\
&= n! [z^n] \exp(mz) \sum_{k=0}^m (-1)^k \exp(-kz){m\choose k}\\
&= n! [z^n] \exp(mz) (1-\exp(-z))^m\\
&= n! [z^n] (\exp(z)-1)^m.
\end{align*}$$
Now $\exp(z)-1 = z + \cdots$ so $(\exp(z)-1)^m = z^m + \cdots$ and hence $n! [z^n] (\exp(z)-1)^m = 0$ when $n\lt m.$
