class SegmentTree: def __init__(self, init_val, segfunc, ide_ele): n = len(init_val) self.segfunc = segfunc self.ide_ele = ide_ele self.num = 1 << (n - 1).bit_length() self.tree = [ide_ele] * 2 * self.num self.size = n for i in range(n): self.tree[self.num + i] = init_val[i] for i in range(self.num - 1, 0, -1): self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1]) def update(self, k, x): k += self.num self.tree[k] += x while k > 1: self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1]) k >>= 1 def query(self, l, r): if r==self.size: r = self.num res = self.ide_ele l += self.num r += self.num while l < r: if l & 1: res = self.segfunc(res, self.tree[l]) l += 1 if r & 1: res = self.segfunc(res, self.tree[r - 1]) l >>= 1 r >>= 1 return res import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import gcd,log input = lambda :sys.stdin.buffer.readline() mi = lambda :map(int,input().split()) li = lambda :list(mi()) mod = 10**9 + 7 N,M = mi() mod = M dp = [[0 for k in range(N**2+1)] for j in range(N+1)] dp[0][0] = 1 for n in range(2*N): ndp = [[0 for k in range(N**2+1)] for j in range(N+1)] for i in range(min(n+1,N+1)): j = n - i for k in range(N**2+1): if i!=N and k+j<=N**2: ndp[i+1][k+j] += dp[i][k] ndp[i+1][k+j] %= mod if j!=N and i>=j+1: ndp[i][k] += dp[i][k] ndp[i][k] %= mod dp = ndp for inv in range(N**2+1): print(dp[N][inv])