#include<bits/stdc++.h>
using namespace std;
inline int exgcd(int a,int b,int &x,int &y) {
if(b==0) {
x=1;
y=0;
return a;
}
int ans=exgcd(b,a%b,x,y);
int tp=x;
x=y;
y=tp-a/b*y;
return ans;
}
inline int in() {
int k=0,f=1;
char c=getchar_unlocked();
while(c<'0'||c>'9') {
if(c=='-') f=-1;
c=getchar_unlocked();
}
while(c>='0'&&c<='9') {
k=k<<1;
k*=5;
k+=(c-'0');
c=getchar_unlocked();
}
return k*f;
}
inline void out(int x){
if(x<0) putchar_unlocked('-'),x=-x;
if(x<10) putchar_unlocked(x+'0');
else out(x/10),putchar_unlocked(x%10+'0');
}
main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n=in(),p=in(),x,y;
for(register int i=1;i<=n;i++){
x=y=0;
exgcd(i,p,x,y);
x=(x%p+p)%p;
out(x);
putchar_unlocked('\n');
}
}