#P5396. Compute Stirling Numbers of the Second Kind for Fixed k

    ID: 18628 Type: Default 1000ms 256MiB

Compute Stirling Numbers of the Second Kind for Fixed k

Compute Stirling Numbers of the Second Kind for Fixed k

The Stirling numbers of the second kind, denoted by \(\begin{Bmatrix} n \\ m \end{Bmatrix}\), count the number of ways to partition \(n\) distinct elements into \(m\) indistinguishable nonempty subsets.

Given two integers \(n\) and \(k\), you are required to compute \(\begin{Bmatrix} i \\ k \end{Bmatrix}\) for all integers \(i\) in the interval \([0, n]\). Since the answers may be very large, output each answer modulo \(167772161\) (which is a prime number given by \(2^{25}\times5+1\)).

Note: By convention, \(\begin{Bmatrix} 0 \\ 0 \end{Bmatrix} = 1\) and \(\begin{Bmatrix} n \\ k \end{Bmatrix} = 0\) if \(n 0\)).

inputFormat

The first line of the input contains two integers \(n\) and \(k\) separated by a space.

outputFormat

Output \(n+1\) integers where the \(i\)-th integer (0-indexed) is \(\begin{Bmatrix} i \\ k \end{Bmatrix}\) modulo \(167772161\). The outputs should be printed in one line separated by spaces.

sample

5 3
0 0 0 1 6 25