#include<iostream>
using namespace std;
#define int long long
int a,b,x,y;
inline void Myfunc(int a,int b){
if(b==0){
x=1,y=0;
return;
}
Myfunc(b,a%b);
int tmp=x;
x=y;
y=tmp-a/b*y;
}
inline int read(){
int ret=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=!f;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
ret*=10;
ret+=ch-'0';
ch=getchar();
}
return ret*f;
}
inline void write(int x){
if(x>9)write(x/10);
putchar(x%10^48);
}
signed main(){
ios::sync_with_stdio(0);
int n,p;
n=read();
p=read();
for(int i=1;i<=n;++i){
Myfunc(i,p);
write((x%p+p)%p);
putchar('\n');
}
}