#include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vector P(N + 1), Q(N + 1), invQ; Q[0] = 1; for(int i = 1; i * (3 * i - 1) / 2 <= N; i++){ Q[i * (3 * i - 1) / 2] = i & 1 ? -1 : 1; } for(int i = -1; i * (3 * i - 1) / 2 <= N; i--){ Q[i * (3 * i - 1) / 2] = i & 1 ? -1 : 1; } for(int i = 0; i * (K + 1) <= N; i++){ P[i * (K + 1)] = Q[i]; } invQ.reserve(Q.size()); invQ = {Q[0].inv()}; while(invQ.size() < Q.size()){ const int M = 2 * invQ.size(); vector buf(M), fres(M); copy(Q.begin(), Q.begin() + min(M, N + 1), buf.begin()); copy(invQ.begin(), invQ.end(), fres.begin()); internal::butterfly(buf); internal::butterfly(fres); for(int i = 0; i < M; i++) buf[i] *= fres[i]; internal::butterfly_inv(buf); fill(buf.begin(), buf.begin() + invQ.size(), 0); internal::butterfly(buf); for(int i = 0; i < M; i++) buf[i] *= fres[i]; internal::butterfly_inv(buf); mint coef = -mint(mint(1 - mint::mod()) / buf.size()).pow(2); for (int i = invQ.size(); i < min(M, N + 1); i++) invQ.push_back(buf[i] * coef); } auto ans = convolution(P, invQ); for(int i = 1; i <= N; i++){ cout << ans[i].val() << (i == N ? '\n' : ' '); } }