#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
	char c=getchar();int x=0,f=0;
	for(;!isdigit(c);c=getchar())if(c=='-')f=1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

int mod;
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint&operator =(int o){return x=o,*this;}
	modint&operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint&operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint&operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint&operator ^=(int b){
		modint c=1,a=*this;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint&operator /=(modint o){return (*this)*=(o^=(mod-2));}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	modint operator -(){return x?mod-x:0;}
};

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

int n;
modint f[2][505][505];
modint g[505][505],h[505][505];
modint C[505][505];

signed main()
{
	freopen("tree.in","r",stdin);
	freopen("tree.out","w",stdout);
	n=read(),mod=read();
	C[0][0]=1;
	For(i,1,n){
		C[i][0]=1;
		For(j,1,i)C[i][j]=C[i-1][j-1]+C[i-1][j];
	}
//	For(i,0,n)For(j,0,n)cout<<C[i][j].x<<" \n"[j==n];
	f[1][1][1]=1;
	For(i,2,n){
		int now=i&1,lst=now^1;
		For(k1,1,i)
			For(k2,1,i)
				if(f[lst][k1][k2].x){
					modint t=f[lst][k1][k2];
					f[lst][k1][k2]=0;
					f[now][k1+1][k2+1]+=t;
					For(l1,1,k1)
						g[k1+1-l1][k2]+=t*C[k1][l1];
				//	For(l1,0,k1)
				//		For(l2,0,k2)
				//			if(l1&&l2)
				//				f[now][k1+1-l1][k2+1-l2]+=t*C[k1][l1]*C[k2][l2];
				}
		For(k1,1,i)
			For(k2,1,i)
				if(g[k1][k2].x){
					modint t=g[k1][k2];
					g[k1][k2]=0;
					For(l2,1,k2)
						f[now][k1][k2+1-l2]+=t*C[k2][l2];
				}
		modint res=f[now][1][1];//cout<<f[now][1][1].x<<" ";
		cout<<res.x<<'\n';
	//	For(k1,1,i)For(k2,1,i)cout<<f[now][k1][k2].x<<" \n"[k2==i];puts("------");
	}
	return 0;
}
