#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int qp(int a,int k,int m)
{
int res=1;
while(k){
if(k&1) res=(ll)res*a%m;
k>>=1;
a=(ll)a*a%m;
}
return res;
}
int main()
{
int n,p;
cin>>n>>p;
for(int i=1;i<=n;i++){
printf("%d\n",qp(i,p-2,p));
}
return 0;
}