#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Rg register
#define RI Rg int
#define Cn const
#define CI Cn int&
#define I inline
#define W while
#define N 500
using namespace std;
int n,X,ans[N+5],C[N+5][N+5],f[N+5][N+5][N+5];
int main()
{
	freopen("tree.in","r",stdin),freopen("tree.out","w",stdout);
	RI i,j,k,p,q,o;for(scanf("%d%d",&n,&X),i=1;i<=n;++i) f[1][0][i]=i;
	for(C[0][0]=i=1;i<=n;++i) for(C[i][0]=j=1;j<=i;++j) C[i][j]=(C[i-1][j-1]+C[i-1][j])%X;
	for(i=2;i<=n;++i)
	{
		for(j=0;j<i;++j) for(p=1;p<=n-i+1;++p) if(o=f[i-1][j][p]) f[i][j][p]=(f[i][j][p]+1LL*o*(i-1-j))%X;
		for(j=i;~j;--j) for(p=n-i+1;p;--p)
		{
			o=f[i][j][p],f[i][j][p]=1LL*p*o%X,f[i][j+1][p]=(f[i][j+1][p]+1LL*(X-p)*o)%X;
			if(p==1) ans[i]=(ans[i]+1LL*o)%X;else f[i][j+1][p-1]=(f[i][j+1][p-1]+1LL*(p-1)*o)%X,
			f[i][j+1][p-1]=(f[i][j+1][p-1]+1LL*f[i][j][p-1]*(X-p+1))%X;
		}
	}
	for(i=2;i<=n;++i) printf("%d\n",ans[i]);return 0;
}