/* -- Defined Functions -- */ #define For(a,x,y) for (int a = x; a <= y; ++a) #define Forw(a,x,y) for (int a = x; a < y; ++a) #define Bak(a,y,x) for (int a = y; a >= x; --a)
namespace FastIO { inlinelonglongintgetint(){ longlongint s = 0, x = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') x = -1; ch = getchar(); } while (isdigit(ch)) { s = s * 10ll + ch - '0'; ch = getchar(); } return s * x; } inlinevoid __basic_putint(longlongint x) { if (x < 0) { x = -x; putchar('-'); } if (x >= 10) __basic_putint(x / 10); putchar(x % 10 + '0'); }
longlongint n, k, HA, a[MAXN]; longlongint fac[MAXN], invf[MAXN];
longlongintSlowPower(longlongint a, longlongint x){ // a^x mod m longlongint ret = 1; if (x == 1) return a; while (x) { if (x & 1) ret = ret * a % HA; a = a * a % HA; x >>= 1; } return ret; } }
signedmain(){ usingnamespace Solution; usingnamespace FastIO; n = getint(); HA = getint(); fac[0] = 1; for (int i = 1; i <= n; ++i) { fac[i] = (fac[i - 1] * i) % HA; } invf[n] = SlowPower(fac[n], HA - 2); for (longlongint i = n - 1; i >= 1; --i) { invf[i] = (invf[i + 1] * (i + 1)) % HA; } for (longlongint i = 1; i <= n; ++i) { printf("%lld\n", (invf[i] * fac[i - 1]) % HA); } return0; }