#include using namespace atcoder; #include using namespace internal; #include using namespace std; #include #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i,a,b) for (int i = (int)(a); i < (int)(b); i++) #define all(v) v.begin(),v.end() #define inc(x,l,r) ((l)<=(x)&&(x)<(r)) #define Unique(x) sort(all(x)), x.erase(unique(all(x)), x.end()) #define pcnt __builtin_popcountll #define pb push_back typedef long long ll; #define int ll using ld = long double; using vi = vector; using vs = vector; using P = pair; using vp = vector

; using ull = unsigned long long; using Bint = boost::multiprecision::cpp_int; template bool chmax(T1 &a, const T2 b) {if (a < b) {a = b; return true;} else return false; } template bool chmin(T1 &a, const T2 b) {if (a > b) {a = b; return true;} else return false; } template using priority_queue_greater = priority_queue, greater>; template ostream &operator<< (ostream &os, const pair &p){os << p.first <<" "<> (istream &is, modint1000000007 &m){ll in;is>>in;m=in;return is;} ostream &operator<< (ostream &os, const modint998244353 &m){os << m.val();return os;} istream &operator>> (istream &is, modint998244353 &m){ll in;is>>in;m=in;return is;} template istream &operator>>(istream& is,vector &v){for(T &in:v)is>>in;return is;} template void input(T&... a){(cin>> ... >> a);} #ifdef LOCAL template ostream &operator<<(ostream &os,const vector &v){os<<"\x1b[32m";rep(i,v.size())os< int print(T& a){cout << "\x1b[32m"<< a<< '\n' << "\x1b[0m";return 0;} template int print(const T&a, const Ts&... b){cout << "\x1b[32m" << a;(cout<<...<<(cout<<' ',b));cout<<'\n' << "\x1b[0m";return 0;} #else template ostream &operator<<(ostream &os,const vector &v){rep(i,v.size())os< int print(T& a){cout << a<< '\n';return 0;} template int print(const T&a, const Ts&... b){cout << a;(cout<<...<<(cout<<' ',b));cout<<'\n';return 0;} #endif #define VI(v,n) vi v(n); input(v) #define INT(...) int __VA_ARGS__; input(__VA_ARGS__) #define STR(...) string __VA_ARGS__; input(__VA_ARGS__) #define CHAR(...) char __VA_ARGS__; input(__VA_ARGS__) int sign(ll x){return x>0?1:x<0?-1:0;} ll ceil(ll x,ll y){assert(y!=0);if(sign(x)==sign(y))return (x+y-1)/y;return -((-x/y));} ll floor(ll x,ll y){assert(y!=0);if(sign(x)==sign(y))return x/y;if(y<0)x*=-1,y*=-1;return x/y-(x%y<0);} ll abs(ll x,ll y){return abs(x-y);} ll bit(int n){return 1ll< bool ins(string s,T t){return s.find(t)!=string::npos;} P operator+ (const P &p, const P &q){ return P{p.first+q.first,p.second+q.second};} P operator- (const P &p, const P &q){ return P{p.first-q.first,p.second-q.second};} int yesno(bool ok,string y="Yes",string n="No"){ cout<<(ok?y:n)<= (n); --i) #define drep(i, n) drep2(i, n, 0) template struct FormalPowerSeries : vector { using vector::vector; using vector::operator=; using F = FormalPowerSeries; F operator-() const { F res(*this); for (auto &e : res) e = -e; return res; } F &operator*=(const T &g) { for (auto &e : *this) e *= g; return *this; } F &operator/=(const T &g) { assert(g != T(0)); *this *= g.inv(); return *this; } F &operator+=(const F &g) { int n = (*this).size(), m = g.size(); rep(i, min(n, m)) (*this)[i] += g[i]; return *this; } F &operator-=(const F &g) { int n = (*this).size(), m = g.size(); rep(i, min(n, m)) (*this)[i] -= g[i]; return *this; } F &operator<<=(const int d) { int n = (*this).size(); (*this).insert((*this).begin(), d, 0); (*this).resize(n); return *this; } F &operator>>=(const int d) { int n = (*this).size(); (*this).erase((*this).begin(), (*this).begin() + min(n, d)); (*this).resize(n); return *this; } F inv(int d = -1) const { int n = (*this).size(); assert(n != 0 && (*this)[0] != 0); if (d == -1) d = n; assert(d > 0); F res{(*this)[0].inv()}; while (res.size() < d) { int m = size(res); F f(begin(*this), begin(*this) + min(n, 2*m)); F r(res); f.resize(2*m), internal::butterfly(f); r.resize(2*m), internal::butterfly(r); rep(i, 2*m) f[i] *= r[i]; internal::butterfly_inv(f); f.erase(f.begin(), f.begin() + m); f.resize(2*m), internal::butterfly(f); rep(i, 2*m) f[i] *= r[i]; internal::butterfly_inv(f); T iz = T(2*m).inv(); iz *= -iz; rep(i, m) f[i] *= iz; res.insert(res.end(), f.begin(), f.begin() + m); } return {res.begin(), res.begin() + d}; } F pow(int t){ if(t==1)return *this; F r = pow(t>>1); r *= r; if(t&1)r*=(*this); return r; } // O(n log n) F &multiply_inplace(const F &g, int d = -1) { int n = this->size(); if (d == -1) d = n; assert(d >= 0); *this = convolution(move(*this), g); this->resize(d); return *this; } F multiply(const F &g, const int d = -1) const { return F(*this).multiply_inplace(g, d); } // O(n log n) F ÷_inplace(const F &g, int d = -1) { int n = this->size(); if (d == -1) d = n; assert(d >= 0); *this = convolution(move(*this), g.inv(d)); this->resize(d); return *this; } F divide(const F &g, const int d = -1) const { return F(*this).divide_inplace(g, d); } F &operator*=(vector> g) { sort(all(g),[](const pair &a,const pair &b){return a.first i) break; (*this)[i] += (*this)[i-j] * b; } } return *this; } F &operator/=(vector> g) { sort(all(g),[](const pair &a,const pair &b){return a.first i) break; (*this)[i] -= (*this)[i-j] * b; } (*this)[i] *= ic; } return *this; } // multiply and divide (1 + cz^d) void multiply(const int d, const T c) { int n = (*this).size(); if (c == T(1)) drep(i, n-d) (*this)[i+d] += (*this)[i]; else if (c == T(-1)) drep(i, n-d) (*this)[i+d] -= (*this)[i]; else drep(i, n-d) (*this)[i+d] += (*this)[i] * c; } void divide(const int d, const T c) { int n = (*this).size(); if (c == T(1)) rep(i, n-d) (*this)[i+d] -= (*this)[i]; else if (c == T(-1)) rep(i, n-d) (*this)[i+d] += (*this)[i]; else rep(i, n-d) (*this)[i+d] -= (*this)[i] * c; } T eval(const T &a) const { T x(1), res(0); for (auto e : *this) res += e * x, x *= a; return res; } // O(n) F &integ_inplace() { int n = this->size(); assert(n > 0); if (n == 1) return *this = F{0}; this->insert(this->begin(), 0); this->pop_back(); vector inv(n); inv[1] = 1; int p = T::mod(); rep2(i, 2, n) inv[i] = - inv[p%i] * (p/i); rep2(i, 2, n) (*this)[i] *= inv[i]; return *this; } F integ() const { return F(*this).integ_inplace(); } // O(n) F &deriv_inplace() { int n = this->size(); assert(n > 0); rep2(i, 2, n) (*this)[i] *= i; this->erase(this->begin()); this->push_back(0); return *this; } F deriv() const { return F(*this).deriv_inplace(); } // O(n log n) F &log_inplace(int d = -1) { int n = this->size(); assert(n > 0 && (*this)[0] == 1); if (d == -1) d = n; assert(d >= 0); if (d < n) this->resize(d); F f_inv = this->inv(); this->deriv_inplace(); this->multiply_inplace(f_inv); this->integ_inplace(); return *this; } F log(const int d = -1) const { return F(*this).log_inplace(d); } // O(n log n) F &exp_inplace(int d = -1) { int n = this->size(); assert(n > 0 && (*this)[0] == 0); if (d == -1) d = n; assert(d >= 0); F g{1}, g_fft; this->resize(d); (*this)[0] = 1; F h_drv(this->deriv()); for (int m = 1; m < d; m *= 2) { // prepare F f_fft(this->begin(), this->begin() + m); f_fft.resize(2*m), internal::butterfly(f_fft); // Step 2.a' if (m > 1) { F _f(m); rep(i, m) _f[i] = f_fft[i] * g_fft[i]; internal::butterfly_inv(_f); _f.erase(_f.begin(), _f.begin() + m/2); _f.resize(m), internal::butterfly(_f); rep(i, m) _f[i] *= g_fft[i]; internal::butterfly_inv(_f); _f.resize(m/2); _f /= T(-m) * m; g.insert(g.end(), _f.begin(), _f.begin() + m/2); } // Step 2.b'--d' F t(this->begin(), this->begin() + m); t.deriv_inplace(); { // Step 2.b' F r{h_drv.begin(), h_drv.begin() + m-1}; // Step 2.c' r.resize(m); internal::butterfly(r); rep(i, m) r[i] *= f_fft[i]; internal::butterfly_inv(r); r /= -m; // Step 2.d' t += r; t.insert(t.begin(), t.back()); t.pop_back(); } // Step 2.e' t.resize(2*m); internal::butterfly(t); g_fft = g; g_fft.resize(2*m); internal::butterfly(g_fft); rep(i, 2*m) t[i] *= g_fft[i]; internal::butterfly_inv(t); t.resize(m); t /= 2*m; // Step 2.f' F v(this->begin() + m, this->begin() + min(d, 2*m)); v.resize(m); t.insert(t.begin(), m-1, 0); t.push_back(0); t.integ_inplace(); rep(i, m) v[i] -= t[m+i]; // Step 2.g' v.resize(2*m); internal::butterfly(v); rep(i, 2*m) v[i] *= f_fft[i]; internal::butterfly_inv(v); v.resize(m); v /= 2*m; // Step 2.h' rep(i, min(d-m, m)) (*this)[m+i] = v[i]; } return *this; } F exp(const int d = -1) const { return F(*this).exp_inplace(d); } // O(n log n) F &pow_inplace(ll k, int d = -1) { int n = this->size(); if (d == -1) d = n; assert(d >= 0); int l = 0; while ((*this)[l] == 0) ++l; if (l > d/k) return *this = F(d); T ic = (*this)[l].inv(); T pc = (*this)[l].pow(k); this->erase(this->begin(), this->begin() + l); *this *= ic; this->log_inplace(); *this *= k; this->exp_inplace(); *this *= pc; this->insert(this->begin(), l*k, 0); this->resize(d); return *this; } F pow(const ll k, const int d = -1) const { return F(*this).pow_inplace(k, d); } F &operator*=(const F &g) { return multiply_inplace(g); } F &operator/=(const F &g) { return divide_inplace(g); } F operator*(const T &g) const { return F(*this) *= g; } F operator/(const T &g) const { return F(*this) /= g; } F operator+(const F &g) const { return F(*this) += g; } F operator-(const F &g) const { return F(*this) -= g; } F operator<<(const int d) const { return F(*this) <<= d; } F operator>>(const int d) const { return F(*this) >>= d; } F operator*(vector> g) const { return F(*this) *= g; } F operator/(vector> g) const { return F(*this) /= g; } }; using fps = FormalPowerSeries; using sfps = vector>; // log(1-x^k) n/k個の非ゼロの項の和 sfps log_(int n,int k){ sfps res; for(int i=1;i*k<=n;i++)res.emplace_back(i*k,-(mint(i).inv())); return res; } void add_sfps(fps &f,sfps &s){ for(auto [k,v]:s)f[k]+=v; } signed main() { INT(N,K); fps f(N+1); for(int j=1;j<=N;j++){ auto s = log_(N,(K+1)*j); add_sfps(f,s); } for(int j=1;j<=N;j++){ auto s = log_(N,j); for(auto &e:s)e.second *= -1; add_sfps(f,s); } f.exp_inplace(); for(int x=1;x<=N;x++)cout<