n, MOD = map(int, input().split()) nCr = [[0] * (n + 1) for _ in range(n + 1)] nCr[0][0] = 1 for i in range(n + 1): for j in range(n + 1): nCr[i][j] %= MOD if i < n: nCr[i + 1][j] += nCr[i][j] if j < n: nCr[i + 1][j + 1] += nCr[i][j] dp = [[0] * (n + 1) for _ in range(n + 1)] dp[0][0] = 1 powk = [0] * (n + 1) powk[1] = 1 for i in range(2, n + 1): powk[i] = pow(i, i - 2, MOD) for i in range(n): for j in range(n): dp[i][j] %= MOD for k in range(1, n + 1 - i): if k == 1: dp[i + k][j + 1] += dp[i][j] * nCr[n - i - 1][k - 1] else: dp[i + k][j + 1] += dp[i][j] * nCr[n - i - 1][k - 1] * powk[k] for x in dp[n][::-1][:-1]: print(x % MOD)