#pragma GCC optimisation("O3")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define NUM1 1000000007LL
#define all(a) a.begin(), a.end()
#define beg(a) a.begin(), a.begin()
#define sq(a) ((a)*(a))
#define NUM2 998244353LL
#define MOD NUM1
#define LMOD 1000000006LL
#define fi first
#define se second
typedef long double ld;
const ll MAX = 500;
const ll MAX2 = MAX;
const ll large = 1e18;
ld eps = 1e-14l;
ll mod;
ll binpow(ll a, ll n){
    if(n == 0) return 1;
    ll v = binpow(a, n/2);
    v = (v*v)%mod;
    if(n%2 == 1) return (a*v)%mod;
    else return v;
}


void update(vector<ll>& seg, ll tl, ll tr, ll v, ll pos, ll nval)
{
    if(tl == tr){
        seg[v] = binpow(pos, nval);
        return;
    }
    ll tm = (tl + tr)/2;
    if(pos > tm){
        update(seg, tm + 1, tr, 2*v + 2, pos, nval);
    }
    else{
        update(seg, tl, tm, 2*v + 1, pos, nval);
    }
    seg[v] = (seg[2*v + 1]*seg[2*v + 2])%mod;
}



signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n >> mod;
    vector<ll> maxp(n + 1);
    for(ll i = 2; i <= n; i++){
        if(maxp[i] == 0){
            for(ll j = i; j <= n; j += i) maxp[j] = i;
        }
    }
    vector<ll> freq(n + 1), seg(4*n + 4, 1);
    vector<ll> dp(n + 1);
    dp[0] = 1;
    for(ll i = 1; i <= n; i++){
        ll mult = n - i + 1;
        ll hold = mult;
        while(hold != 1){
            ll p = maxp[hold];
            ll c = 0;
            while(hold%p == 0){
                hold /= p;
                c++;
            }
            freq[p] += c;
            update(seg, 0, n, 0, p, freq[p]);
        }
        ll div = i;
        hold = div;
        while(hold != 1){
            ll p = maxp[hold];
            ll c = 0;
            while(hold%p == 0){
                hold /= p;
                c++;
            }
            freq[p] -= c;
            update(seg, 0, n, 0, p, freq[p]);
        }
        dp[i] = seg[0];
    }
    for(auto x: dp) cout << x << ' ';
	return 0;
}