#include using namespace std; #define int long long #define ii pair #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcountll #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock()/CLOCKS_PER_SEC #define debug(x) std::cout << #x << ": " << x << '\n'; const int md = 998244353; namespace faq{ inline void add(int &x, int y) { x += y; if (x >= md) { x -= md; } } inline void sub(int &x, int y) { x -= y; if (x < 0) { x += md; } } inline int mul(int x, int y) { return (long long) x * y % md; } inline int power(int x, int y) { int res = 1; for (; y; y >>= 1, x = mul(x, x)) { if (y & 1) { res = mul(res, x); } } return res; } inline int inv(int a) { a %= md; if (a < 0) { a += md; } int b = md, u = 0, v = 1; while (a) { int t = b / a; b -= t * a; swap(a, b); u -= t * v; swap(u, v); } if (u < 0) { u += md; } return u; } namespace ntt { int base = 1, root = -1, max_base = -1; vector rev = {0, 1}, roots = {0, 1}; void init() { int temp = md - 1; max_base = 0; while (temp % 2 == 0) { temp >>= 1; ++max_base; } root = 2; while (true) { if (power(root, 1 << max_base) == 1 && power(root, 1 << max_base - 1) != 1) { break; } ++root; } } void ensure_base(int nbase) { if (max_base == -1) { init(); } if (nbase <= base) { return; } assert(nbase <= max_base); rev.resize(1 << nbase); for (int i = 0; i < 1 << nbase; ++i) { rev[i] = rev[i >> 1] >> 1 | (i & 1) << nbase - 1; } roots.resize(1 << nbase); while (base < nbase) { int z = power(root, 1 << max_base - 1 - base); for (int i = 1 << base - 1; i < 1 << base; ++i) { roots[i << 1] = roots[i]; roots[i << 1 | 1] = mul(roots[i], z); } ++base; } } void dft(vector &a) { int n = a.size(), zeros = __builtin_ctz(n); ensure_base(zeros); int shift = base - zeros; for (int i = 0; i < n; ++i) { if (i < rev[i] >> shift) { swap(a[i], a[rev[i] >> shift]); } } for (int i = 1; i < n; i <<= 1) { for (int j = 0; j < n; j += i << 1) { for (int k = 0; k < i; ++k) { int x = a[j + k], y = mul(a[j + k + i], roots[i + k]); a[j + k] = (x + y) % md; a[j + k + i] = (x + md - y) % md; } } } } vector multiply(vector a, vector b) { int need = a.size() + b.size() - 1, nbase = 0; while (1 << nbase < need) { ++nbase; } ensure_base(nbase); int sz = 1 << nbase; a.resize(sz); b.resize(sz); bool equal = a == b; dft(a); if (equal) { b = a; } else { dft(b); } int inv_sz = inv(sz); for (int i = 0; i < sz; ++i) { a[i] = mul(mul(a[i], b[i]), inv_sz); } reverse(a.begin() + 1, a.end()); dft(a); a.resize(need); return a; } vector inverse(vector a) { int n = a.size(), m = n + 1 >> 1; if (n == 1) { return vector(1, inv(a[0])); } else { vector b = inverse(vector(a.begin(), a.begin() + m)); int need = n << 1, nbase = 0; while (1 << nbase < need) { ++nbase; } ensure_base(nbase); int sz = 1 << nbase; a.resize(sz); b.resize(sz); dft(a); dft(b); int inv_sz = inv(sz); for (int i = 0; i < sz; ++i) { a[i] = mul(mul(md + 2 - mul(a[i], b[i]), b[i]), inv_sz); } reverse(a.begin() + 1, a.end()); dft(a); a.resize(n); return a; } } } using ntt::multiply; using ntt::inverse; vector& operator += (vector &a, const vector &b) { if (a.size() < b.size()) { a.resize(b.size()); } for (int i = 0; i < b.size(); ++i) { add(a[i], b[i]); } return a; } vector operator + (const vector &a, const vector &b) { vector c = a; return c += b; } vector& operator -= (vector &a, const vector &b) { if (a.size() < b.size()) { a.resize(b.size()); } for (int i = 0; i < b.size(); ++i) { sub(a[i], b[i]); } return a; } vector operator - (const vector &a, const vector &b) { vector c = a; return c -= b; } vector& operator *= (vector &a, const vector &b) { if (min(a.size(), b.size()) < 128) { vector c = a; a.assign(a.size() + b.size() - 1, 0); for (int i = 0; i < c.size(); ++i) { for (int j = 0; j < b.size(); ++j) { add(a[i + j], mul(c[i], b[j])); } } } else { a = multiply(a, b); } return a; } vector operator * (const vector &a, const vector &b) { vector c = a; return c *= b; } vector& operator /= (vector &a, const vector &b) { int n = a.size(), m = b.size(); if (n < m) { a.clear(); } else { vector c = b; reverse(a.begin(), a.end()); reverse(c.begin(), c.end()); c.resize(n - m + 1); a *= inverse(c); a.erase(a.begin() + n - m + 1, a.end()); reverse(a.begin(), a.end()); } return a; } vector operator / (const vector &a, const vector &b) { vector c = a; return c /= b; } vector& operator %= (vector &a, const vector &b) { int n = a.size(), m = b.size(); if (n >= m) { vector c = (a / b) * b; a.resize(m - 1); for (int i = 0; i < m - 1; ++i) { sub(a[i], c[i]); } } return a; } vector operator % (const vector &a, const vector &b) { vector c = a; return c %= b; } vector derivative(const vector &a) { int n = a.size(); vector b(n - 1); for (int i = 1; i < n; ++i) { b[i - 1] = mul(a[i], i); } return b; } vector primitive(const vector &a) { int n = a.size(); vector b(n + 1), invs(n + 1); for (int i = 1; i <= n; ++i) { invs[i] = i == 1 ? 1 : mul(md - md / i, invs[md % i]); b[i] = mul(a[i - 1], invs[i]); } return b; } vector logarithm(const vector &a) { vector b = primitive(derivative(a) * inverse(a)); b.resize(a.size()); return b; } vector exponent(const vector &a) { vector b(1, 1); while (b.size() < a.size()) { vector c(a.begin(), a.begin() + min(a.size(), b.size() << 1)); add(c[0], 1); vector old_b = b; b.resize(b.size() << 1); c -= logarithm(b); c *= old_b; for (int i = b.size() >> 1; i < b.size(); ++i) { b[i] = c[i]; } } b.resize(a.size()); return b; } vector power(const vector &a, int m) { int n = a.size(), p = -1; vector b(n); for (int i = 0; i < n; ++i) { if (a[i]) { p = i; break; } } if (p == -1) { b[0] = !m; return b; } if ((long long) m * p >= n) { return b; } int mu = power(a[p], m), di = inv(a[p]); vector c(n - m * p); for (int i = 0; i < n - m * p; ++i) { c[i] = mul(a[i + p], di); } c = logarithm(c); for (int i = 0; i < n - m * p; ++i) { c[i] = mul(c[i], m); } c = exponent(c); for (int i = 0; i < n - m * p; ++i) { b[i + m * p] = mul(c[i], mu); } return b; } vector sqrt(const vector &a) { vector b(1, 1); while (b.size() < a.size()) { vector c(a.begin(), a.begin() + min(a.size(), b.size() << 1)); vector old_b = b; b.resize(b.size() << 1); c *= inverse(b); for (int i = b.size() >> 1; i < b.size(); ++i) { b[i] = mul(c[i], md + 1 >> 1); } } b.resize(a.size()); return b; } vector multiply_all(int l, int r, vector> &all) { if (l > r) { return vector(); } else if (l == r) { return all[l]; } else { int y = l + r >> 1; return multiply_all(l, y, all) * multiply_all(y + 1, r, all); } } vector evaluate(const vector &f, const vector &x) { int n = x.size(); if (!n) { return vector(); } vector> up(n * 2); for (int i = 0; i < n; ++i) { up[i + n] = vector{(md - x[i]) % md, 1}; } for (int i = n - 1; i; --i) { up[i] = up[i << 1] * up[i << 1 | 1]; } vector> down(n * 2); down[1] = f % up[1]; for (int i = 2; i < n * 2; ++i) { down[i] = down[i >> 1] % up[i]; } vector y(n); for (int i = 0; i < n; ++i) { y[i] = down[i + n][0]; } return y; } vector interpolate(const vector &x, const vector &y) { int n = x.size(); vector> up(n * 2); for (int i = 0; i < n; ++i) { up[i + n] = vector{(md - x[i]) % md, 1}; } for (int i = n - 1; i; --i) { up[i] = up[i << 1] * up[i << 1 | 1]; } vector a = evaluate(derivative(up[1]), x); for (int i = 0; i < n; ++i) { a[i] = mul(y[i], inv(a[i])); } vector> down(n * 2); for (int i = 0; i < n; ++i) { down[i + n] = vector(1, a[i]); } for (int i = n - 1; i; --i) { down[i] = down[i << 1] * up[i << 1 | 1] + down[i << 1 | 1] * up[i << 1]; } return down[1]; } } namespace mymod { const int MOD = 998244353; int mod(int n) { n %= MOD; if (n < 0) return n + MOD; else return n; } int fp(int a, int p) { int ans = 1, c = a; for (int i = 0; (1ll << i) <= p; ++i) { if ((p >> i) & 1) ans = mod(ans * c); c = mod(c * c); } return ans; } int dv(int a, int b) { return mod(a * fp(b, MOD - 2)); } }; signed main() { #ifdef HOME freopen("input.txt", "r", stdin); #else #define endl '\n' ios_base::sync_with_stdio(0); cin.tie(0); #endif int n, m; cin >> n >> m; vector > a; for (int i = 0; i < n; ++i) { int x; cin >> x; a.app({1, x}); } auto p = faq::multiply_all(0, n - 1, a); while (p.size()<=m) p.app(0); auto ln = faq::logarithm(p); for (int i = 1; i <= m && i < ln.size(); ++i) { int f = mymod::dv(mymod::fp(-1, i - 1), i); cout << mymod::dv(ln[i], f) << ' '; } cout << endl; }