Example 1.29 Let $a_{1}, a_{2}, \cdots, a_{k}$ be $k$ distinct elements, and let $R_{m}\left(n_{1}, n_{2}, \cdots, n_{k}\right)$ represent the number of ways to place $n_{1}$ $a_{1}$'s, $n_{2}$ $a_{2}$'s, $\cdots$, $n_{k}$ $a_{k}$'s into $m$ distinct boxes such that no box is empty. Find the counting formula for $R_{m}\left(n_{1}, n_{2}, \cdots, n_{k}\right)$.
Solution: From Example 1.15, we know that the number of ways to place $n_{1}$ $a_{1}$'s, $n_{2}$ $a_{2}$'s, $\cdots$, $n_{k}$ $a_{k}$'s into $m$ distinct boxes is $\prod_{i=1}^{k}\binom{m+n_{i}-1}{n_{i}}$. Among these, the number of ways such that the number of non-empty boxes is $j(1 \leqslant j \leqslant m)$ is $\binom{m}{j} R_{j}\left(n_{1}, n_{2}, \cdots, n_{k}\right)$. By the principle of addition, we have
$$
\prod_{i=1}^{k}\binom{m+n_{i}-1}{n_{i}}=\sum_{j=1}^{m}\binom{m}{j} R_{j}\left(n_{1}, n_{2}, \cdots, n_{k}\right),
$$

By the binomial inversion formula, we get
$$
R_{m}\left(n_{1}, n_{2}, \cdots, n_{k}\right)=\sum_{j=1}^{m}(-1)^{m-j}\binom{m}{j} \prod_{i=1}^{k}\binom{j+n_{i}-1}{n_{i}} .
$$