#include #include using Fp = atcoder::modint998244353; std::istream& operator>>(std::istream& is, Fp& a) { int v; is >> v; assert(0 <= v && v < Fp::mod()); a = Fp::raw(v); return is; } std::ostream& operator<<(std::ostream& os, Fp a) { return os << a.val(); } using Fps = std::vector; int sz(const Fps& a) { return a.size(); } Fps operator-(Fps a) { for (auto&& e : a) e = -e; return a; } Fps& operator+=(Fps& a, const Fps& b) { if (sz(a) < sz(b)) a.reserve(sz(b)), a.resize(sz(b)); for (int i = 0; i < sz(b); ++i) a[i] += b[i]; return a; } Fps operator+(Fps a, const Fps& b) { return std::move(a += b); } Fps& operator-=(Fps& a, const Fps& b) { if (sz(a) < sz(b)) a.reserve(sz(b)), a.resize(sz(b)); for (int i = 0; i < sz(b); ++i) a[i] -= b[i]; return a; } Fps operator-(Fps a, const Fps& b) { return std::move(a -= b); } Fps& operator*=(Fps& a, Fp b) { for (auto&& e : a) e *= b; return a; } Fps operator*(Fps a, Fp b) { return std::move(a *= b); } Fps operator*(Fp a, Fps b) { return std::move(b *= a); } Fps& operator/=(Fps& a, Fp b) { b = b.inv(); for (auto&& e : a) e *= b; return a; } Fps operator/(Fps a, Fp b) { return std::move(a /= b); } Fps operator*(const Fps& a, const Fps& b) { Fps res = atcoder::convolution(a, b); res.resize(std::max(sz(a), sz(b))); return res; } Fps& operator*=(Fps& a, const Fps& b) { return a = a * b; } Fps inv(const Fps& a) { Fps res{a[0].inv()}; for (res.reserve(sz(a)); sz(res) < sz(a);) { res.resize(std::min(2 * sz(res), sz(a))); res *= Fps{2} - Fps(a.begin(), a.begin() + sz(res)) * res; } return res; } Fps& operator/=(Fps& a, const Fps& b) { return a *= inv(b); } Fps operator/(Fps a, const Fps& b) { return std::move(a /= b); } using Poly = std::vector; Poly mul(const Poly& a, const Poly& b) { return atcoder::convolution(a, b); } struct Tree { int m; std::vector f; explicit Tree(const std::vector& x) : m(sz(x)), f(2 << std::__lg(2 * m - 1)) { for (int i = 0; i < size(); ++i) f[size() + i] = {i < m ? x[i] : 0}; for (int i = size(); i-- > 1;) { f[i].resize(2 * sz(f[2 * i])); f[i] += f[2 * i] + f[2 * i + 1]; Poly prod = mul(f[2 * i], f[2 * i + 1]); for (int j = 0; j < sz(prod); ++j) f[i][j + 1] -= prod[j]; } } int size() const { return f.size() / 2; } Poly get(int i) const { Poly res(sz(f[i]) + 1); for (int j = 0; j < sz(res); ++j) res[j] = j ? -f[i][j - 1] : 1; return res; } Fps power_sum(const std::vector& w, int n) { assert(sz(w) == m); std::vector t(2 * size()); for (int i = 0; i < size(); ++i) t[size() + i] = {i < m ? w[i] : 0}; for (int i = size(); i-- > 1;) t[i] = mul(t[2 * i], get(2 * i + 1)) + mul(t[2 * i + 1], get(2 * i)); Fps num = t[1], den = get(1); num.resize(n), den.resize(n); return num / den; } }; int main() { using namespace std; cin.tie(nullptr)->sync_with_stdio(false); int m, n; cin >> m >> n; vector x(m); for (auto&& e : x) cin >> e; Tree t(x); Fps ans = t.power_sum(vector(m, 1), n + 1); for (int i = 1; i <= n; ++i) cout << ans[i] << " \n"[i == n]; }