#include<bits/stdc++.h>
using namespace std;
#define int long long
int inv[1919810],n,p;
inline int read(){
int f=1,x=0;char ch;
do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
return f*x;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
n=read(),p=read();
inv[1]=1;
cout<<"1\n";
for(int i=2;i<=n;i++){
inv[i]=(p-p/i)*inv[p%i]%p;
cout<<inv[i]<<endl;
}
}