#include"iostream" #include"algorithm" #include"cstring" #include"cstdio" #include"cmath" #include"vector" #include"map" #include"set" #include"queue" usingnamespace std; #define MAXN 200006 //#define int long long #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i) #define pii pair<int,int> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define vi vector<int> #define all(x) (x).begin() , (x).end() #define mem( a ) memset( a , 0 , sizeof a ) typedeflonglong ll; int n , P; int A[MAXN]; int dp[MAXN] , as[MAXN]; int J[MAXN] , iJ[MAXN];
intPow( int x , int a ){ int ret = 1; while( a ) { if( a & 1 ) ret = ret * 1ll * x % P; x = x * 1ll * x % P , a >>= 1; } return ret; }
voidsolve(){ cin >> n >> P; J[0] = iJ[0] = 1; rep( i , 1 , n ) J[i] = J[i - 1] * 1ll * i % P , iJ[i] = Pow( J[i] , P - 2 ); rep( k , 0 , n - 1 ) { dp[0] = J[n]; rep( i , 1 , n ) dp[i] = 0; rep( i , 1 , n ) { dp[i] = ( dp[i] + dp[i - 1] ) % P; for( int l = k + 1 ; l <= i ; l += ( k + 1 ) ) { dp[i] = ( dp[i] + P - dp[i - l] * 1ll * iJ[l] % P ) % P; if( i >= l + 1 ) dp[i] = ( dp[i] + dp[i - l - 1] * 1ll * iJ[l + 1] ) % P; } } as[n - k - 1] = ( J[n] + P - dp[n] ) % P; } rep( i , 0 , n - 1 ) printf("%d\n",as[i]); }