409107: GYM103438 M Counting Phenomenal Arrays

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Counting Phenomenal Arraystime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Let's call an array $$$[a_1, a_2, \ldots, a_k]$$$ of positive integers phenomenal, if the product of its elements is equal to the sum of its elements (i.e. if $$$a_1 a_2 \ldots a_k = a_1 + a_2 + \ldots + a_k$$$) .

For example, the array $$$[2, 2]$$$ is phenomenal, because $$$2\cdot 2 = 2+2 = 4$$$, and $$$[3, 1, 2]$$$ is phenomenal, because $$$3\cdot 1 \cdot 2 = 3 + 1 + 2 = 6$$$, but the array $$$[2, 3]$$$ is not phenomenal, as $$$2\cdot 3 \neq 2+3$$$.

Let $$$f(i)$$$ denote the number of phenomenal arrays of size $$$i$$$. It can be shown that for any fixed $$$i \ge 2$$$ there is only a finite number of phenomenal arrays of size $$$i$$$.

You are given an integer $$$n$$$. Find $$$f(2), f(3), \ldots, f(n)$$$. As these numbers can be very big, output them modulo $$$P$$$, where $$$P$$$ is a given prime number.

Input

The only line of the input contains two integers $$$n, P$$$ ($$$2 \le n \le 2\cdot 10^5$$$, $$$10^8 \le P \le 10^9$$$, $$$P$$$ is prime).

Output

Output $$$n-1$$$ integers — the values $$$f(2), f(3), \ldots, f(n)$$$ modulo $$$P$$$.

ExampleInput
7 804437957
Output
1 6 12 40 30 84 

加入题单

算法标签: