#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<algorithm> #define ll long long using namespace std; ll n,p,a[3000001]; int main() { scanf("%lld%lld",&n,&p); a[1]=1; printf("%lld\n",a[1]); for(int i=2;i<=n;i++) { a[i]=-(p/i)*a[p%i]; a[i]=(a[i]%p+p)%p; printf("%lld\n",a[i]); } return 0; }