Problem #236
Frequency Restriction
Let f(n, m) count the number of sequences (a_{1}, a_{2}, \cdots, a_{m}) of length m and 1 \le a_{i} \le n, such that for each 1 \le i \le n, cnt(i) \le i, where cnt(i) is the number of times i occurs in the sequence.
Find f(50, 1000) mod 10^9 + 7 .