#include
#define N 3000005
#define ll long long
using namespace std;
ll a[N],p;
int n;
int main()
{
scanf("%d%lld",&n,&p);
a[1]=1;
printf("1
");
for (int i=2;i<=n;i++)
{
a[i]=(p-p/i)*a[p%i]%p;
printf("%lld
",a[i]);
}
}