#include <cstdint>
#include <iostream>
#include <istream>

using ll = int64_t;

const ll maxn=3e6+5;
ll inv[maxn];

int main(){
    std::iostream::sync_with_stdio(false);
    std::cout.tie(nullptr);
    ll n,p;
    std::cin>>n>>p;
    inv[1]=1;
    std::cout<<1<<'\n';
    for(ll i{2};i<=n;i++){
        inv[i]=(p-p/i)*inv[p%i]%p;
        std::cout<<inv[i]<<'\n';
    }
}