Under construction

Still being built. Things may change

Counting Phenomenal Arrays

Time limit2sMemory limit1024 MB

Summary
For each size i from 2 to n, count arrays of i positive integers whose product equals their sum, modulo a prime P.
Level

Medium7 of 10

Topics
Math, Combinatorics, Number theory
Solved
No attempts yet

Statement

Call an array [a1,a2,…,ak][a_1, a_2, \ldots, a_k] of positive integers phenomenal if the product of its elements equals the sum of its elements, that is, a1a2…ak=a1+a2+…+aka_1 a_2 \ldots a_k = a_1 + a_2 + \ldots + a_k.

For example, [2,2][2, 2] is phenomenal because 2⋅2=2+2=42 \cdot 2 = 2 + 2 = 4. [3,1,2][3, 1, 2] is phenomenal because 3⋅1⋅2=3+1+2=63 \cdot 1 \cdot 2 = 3 + 1 + 2 = 6. However, [2,3][2, 3] is not phenomenal, since 2⋅3≠2+32 \cdot 3 \neq 2 + 3.

Let f(i)f(i) denote the number of phenomenal arrays of size ii. It can be shown that for any fixed i≥2i \ge 2, there are only finitely many phenomenal arrays of size ii.

You are given an integer nn. Find f(2),f(3),…,f(n)f(2), f(3), \ldots, f(n). Since these numbers can be very large, output each one modulo PP, where PP is a prime given in the input.

Input

The only line of the input contains two integers nn and PP (2≤n≤2⋅1052 \le n \le 2\cdot 10^5, 108≤P≤10910^8 \le P \le 10^9, PP is prime).

Output

Output n−1n-1 integers: the values f(2),f(3),…,f(n)f(2), f(3), \ldots, f(n) modulo PP.

Examples1

  1. Example 1

    Input
    7 804437957
    
    Expected output
    1 6 12 40 30 84