#include<bits/stdc++.h>
using namespace std;
int p,x,y,n;
void exgcd(int a,int b)
{
if(b==0)
{
x=1;
y=0;
}
else
{
swap(x,y);
exgcd(b,a%b);
y-=a/b*x;
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>p;
for(int i=1;i<=n;i++)
{
x=0;
y=0;
exgcd(i,p);
x=(x%p+p)%p;
cout<<x<<'\n';
}
return 0;
}