// luogu-judger-enable-o2
#include
using namespace std ;
typedef long long ll ;
const int N = 3000010 ;
ll n,p ;
ll a[N] ;
int main(){
scanf("%lld %lld",&n,&p) ;
a[1]=1 ;
for (int i=2;i<=n;i++) a[i]=1LL*(p-p/i)*a[p%i]%p ;
for (int i=1;i<=n;i++) printf("%lld
",a[i]) ;
return 0 ;
}