import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;
public final class losing_nim
{
static FastScanner sc=new FastScanner(br);
static long mod;
static int[][] c;
static int n,maxn=505;
static void build()
{
c=new int[maxn][maxn];c[0][0]=1;
for(int i=1;i<maxn;i++)
{
c[i][0]=1;
for(int j=1;j<=i;j++)
{
c[i][j]=add(c[i-1][j],c[i-1][j-1]);
}
}
}
static int add(long a,long b)
{
long ret=a+b;
if(ret>=mod)
{
ret%=mod;
}
return (int)ret;
}
static int mul(long a,long b)
{
long ret=a*b;
if(ret>=mod)
{
ret%=mod;
}
return (int)ret;
}
static int pow(long a,long b)
{
long x=1,y=a;
while(b>0)
{
if(b%2==1)
{
x=mul(x,y);
}
y=mul(y,y);b=b/2;
}
return (int)(x%mod);
}
static int[] mul(int[] a,int[] b)
{
int[] ret=new int[n+1];
for(int i=0;i<b.length;i++)
{
if(b[i]!=0)
{
for(int j=0;j<a.length && i+j<=n;j++)
{
ret[i+j]=add(ret[i+j],mul(b[i],a[j]));
}
}
}
return ret;
}
{
n=sc.nextInt();mod=sc.nextLong();build();
int[] res=new int[n+1];
for(int i=1;i<=n;i++)
{
int[] poly=new int[n+1];poly[0]=1;
for(int j=0;j<9;j++)
{
int[] arr=new int[n+1];int val=2*(1<<j);
for(int k=0,l=0;k<=n;k+=val,l+=2)
{
arr[k]=c[i][l];
}
poly=mul(poly,arr);
}
res[i]=poly[n];
}
for(int i=1;i<=n;i++)
{
for(int j=i-1;j>=0;j--)
{
int now=mul(res[j],c[i][i-j]);
now=mul(now,mod-1);
res[i]=add(res[i],now);
}
out.println(res[i]);
}
out.close();
}
}
class FastScanner
{
this.in = in;
}
while (st == null || !st.hasMoreTokens()) {
}
return st.nextToken();
}
return nextToken().toString();
}
return Integer.
parseInt(nextToken
()); }
return Long.
parseLong(nextToken
()); }
public double nextDouble
() throws Exception { return Double.
parseDouble(nextToken
()); }
}
aW1wb3J0IGphdmEuaW8uKjsKaW1wb3J0IGphdmEudXRpbC4qOwpp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