Let $P_n^m$ be the number of ways in which a set of $m$ elements can be partitioned into disjoint sets of $n$ elements, and $S_n^m$ be the number of surjections from a set of $m$ elements to a set of $n$ elements. I am trying to prove that $S_n^m=n!P_n^m$.
As a hint, I am given the fact that for any surjective function $f:X\to Y$, $\left\{f^{-1}(y)|y\in Y\right\}$ is a partition of $X$ in $n$ sets. This seems valid, since the sets are disjoint(otherwise $f$ wouldn't be single valued), and their union is $X$ because $f$ is defined on $X$.
With that in mind, it would be enough to show that every partition is "generated" by $n!$ functions, but I can't seem to be able to prove that. Any help/hints is appreciated!