#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define pll pair<long long , long long>
const long long Inf = 0x3f3f3f3f ;
const long long mod = 1e9 + 7 ;
int n , p ;
int qpow(int base , int power){
int res = 1 ;
while(power){
if(power & 1){
res = res * base % p ;
}
base = base * base % p ;
power >>= 1 ;
}
return res ;
}
signed main(){
ios::sync_with_stdio(false) ;
cin.tie(nullptr) ;
cout.tie(nullptr) ;
cin >> n >> p ;
for(int i = 1 ; i <= n ; i ++){
cout << qpow(i , p - 2) << ' ' ;
}
return 0 ;
}