#include<iostream>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
int x, y;
void exgcd(int a, int b){
if(!b){
x = 1, y = 0;
return;
}
exgcd(b, a%b);
int t = x;
x = y, y = t - a/b*y;
}
int main(){
int n, p;
cin >> n >> p;
for(int i = 1; i <= n; i++){
exgcd(i, n);
cout << (x%p+p) % p << "\n";
}
return 0;
}