#include <bits/stdc++.h>
#include <cassert>
using namespace std;
using i64 = long long;
const i64 N = 3e6 + 7;
const i64 p = 998244353, gg = 3, ig = 332738118, img = 86583718;
const i64 mod = 998244353;
i64 qpow(i64 a, i64 b)
{
i64 res = 1;
while (b)
{
if (b & 1) res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
namespace Poly {
#define mul(x, y) (1LL * x * y >= mod ? 1LL * x * y % mod : 1LL * x * y)
#define minus(x, y) (1ll * x - y < 0 ? 1ll * x - y + mod : 1ll * x - y)
#define plus(x, y) (1ll * x + y >= mod ? 1ll * x + y - mod : 1ll * x + y)
#define ck(x) (x >= mod ? x - mod : x)
typedef vector<i64> poly;
const i64 G = 3;
const i64 inv_G = qpow(G, mod - 2);
i64 RR[N], inv[N];
void init()
{
inv[0] = inv[1] = 1;
for (i64 i = 2; i < N; i++)
{
inv[i] = 1LL * inv[mod % i] * (mod - mod / i) % mod;
}
}
i64 NTT_init(i64 n)
{
i64 limit = 1, L = 0;
while (limit <= n)
{
limit <<= 1, L++;
}
for (i64 i = 0; i < limit; i++)
{
RR[i] = (RR[i >> 1] >> 1) | ((i & 1) << (L - 1));
}
return limit;
}
i64 deer[2][N];
void NTT(poly &A, i64 type, i64 limit)
{
A.resize(limit);
for (i64 i = 0; i < limit; i++)
{
if (i < RR[i])
{
swap(A[i], A[RR[i]]);
}
}
for (i64 mid = 2, j = 1; mid <= limit; mid <<= 1, j++)
{
i64 len = mid >> 1;
i64 buf1 = qpow(G, (mod - 1) / (1 << j));
i64 buf0 = qpow(inv_G, (mod - 1) / (1 << j));
deer[0][0] = deer[1][0] = 1;
for (i64 i = 1; i < (1 << j); i++)
{
deer[0][i] = 1LL * deer[0][i - 1] * buf0 % mod;
deer[1][i] = 1LL * deer[1][i - 1] * buf1 % mod;
}
for (i64 pos = 0; pos < limit; pos += mid)
{
i64 *wn = deer[type];
for (i64 i = pos; i < pos + len; i++, wn++)
{
i64 tmp = 1LL * (*wn) * A[i + len] % mod;
A[i + len] = ck(A[i] - tmp + mod);
A[i] = ck(A[i] + tmp);
}
}
}
if (type == 0)
{
for (i64 i = 0; i < limit; i++)
{
A[i] = 1LL * A[i] * inv[limit] % mod;
}
}
}
poly poly_mul(poly A, poly B)
{
i64 deg = A.size() + B.size() - 1;
i64 limit = NTT_init(deg);
poly C(limit);
NTT(A, 1, limit);
NTT(B, 1, limit);
for (i64 i = 0; i < limit; i++)
{
C[i] = 1LL * A[i] * B[i] % mod;
}
NTT(C, 0, limit);
C.resize(deg);
return C;
}
poly poly_inv(poly &f, i64 deg)
{
if (deg == 1)
{
return poly(1, qpow(f[0], mod - 2));
}
poly A(f.begin(), f.begin() + deg);
poly B = poly_inv(f, (deg + 1) >> 1);
i64 limit = NTT_init(deg << 1);
NTT(A, 1, limit), NTT(B, 1, limit);
for (i64 i = 0; i < limit; ++i) A[i] = B[i] * (2 - 1LL * A[i] * B[i] % mod + mod) % mod;
NTT(A, 0, limit);
A.resize(deg);
return A;
}
poly poly_dev(poly f)
{
i64 n = f.size();
for (i64 i = 1; i < n; i++)
{
f[i - 1] = 1LL * f[i] * i % mod;
}
return f.resize(n - 1), f;
}
poly poly_idev(poly f)
{
i64 n = f.size();
for (i64 i = n - 1; i; i--)
{
f[i] = 1LL * f[i - 1] * inv[i] % mod;
}
return f[0] = 0, f;
}
poly poly_ln(poly f, i64 deg)
{
poly A = poly_idev(poly_mul(poly_dev(f), poly_inv(f, deg)));
return A.resize(deg), A;
}
poly poly_exp(poly &f, i64 deg)
{
if (deg == 1) return poly(1, 1);
poly B = poly_exp(f, (deg + 1) >> 1);
B.resize(deg);
poly lnB = poly_ln(B, deg);
for (i64 i = 0; i < deg; i++)
{
lnB[i] = ck(f[i] - lnB[i] + mod);
}
i64 limit = NTT_init(deg << 1);
NTT(B, 1, limit), NTT(lnB, 1, limit);
for (i64 i = 0; i < limit; i++)
{
B[i] = 1LL * B[i] * (1LL + lnB[i]) % mod;
}
NTT(B, 0, limit);
B.resize(deg);
return B;
}
poly poly_sqrt(poly &f, i64 deg)
{
if (deg == 1) return poly(1, 1);
poly A(f.begin(), f.begin() + deg);
poly B = poly_sqrt(f, (deg + 1) >> 1);
poly IB = poly_inv(B, deg);
i64 limit = NTT_init(deg << 1);
NTT(A, 1, limit), NTT(IB, 1, limit);
for (i64 i = 0; i < limit; ++i) A[i] = 1ll * A[i] * IB[i] % mod;
NTT(A, 0, limit);
for (i64 i = 0; i < deg; ++i) A[i] = 1ll * (A[i] + B[i]) * inv[2] % mod;
A.resize(deg);
return A;
}
poly poly_pow(poly f, i64 k)
{
if (f.size() == 1)
{
f[0] = qpow(f[0], k);
return f;
}
f = poly_ln(f, f.size());
for (auto &x : f) x = 1ll * x * k % mod;
return poly_exp(f, f.size());
}
array<poly, 2> poly_div(poly f, poly g)
{
array<poly, 2> res;
i64 deg_f = f.size() - 1, deg_g = g.size() - 1;
poly f_r = f, g_r = g;
reverse(f_r.begin(), f_r.end());
reverse(g_r.begin(), g_r.end());
g_r.resize(deg_f - deg_g + 1);
res[0] = poly_mul(f_r, poly_inv(g_r, deg_f - deg_g + 1));
res[0].resize(deg_f - deg_g + 1);
reverse(res[0].begin(), res[0].end());
poly div = poly_mul(res[0], g);
res[1].resize(deg_g);
for (int i = 0; i < deg_g; i++)
{
res[1][i] = minus(f[i], div[i]);
}
return res;
}
poly poly_arcsin(poly f, i64 deg)
{
poly A(f.size()), B(f.size()), C(f.size());
A = poly_dev(f);
B = poly_mul(f, f);
for (i64 i = 0; i < deg; i++) B[i] = minus(mod, B[i]);
B[0] = plus(B[0], 1);
C = poly_sqrt(B, deg);
C = poly_inv(C, deg);
C = poly_mul(A, C);
C = poly_idev(C);
return C;
}
poly poly_arctan(poly f, i64 deg)
{
poly A(f.size()), B(f.size()), C(f.size());
A = poly_dev(f);
B = poly_mul(f, f);
B[0] = plus(B[0], 1);
C = poly_inv(B, deg);
C = poly_mul(A, C);
C = poly_idev(C);
return C;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
Poly::init();
i64 n, type;
cin >> n >> type;
vector<i64> a(n);
for (auto &x : a) cin >> x;
vector<i64> res(n);
if (type == 0)
res = Poly::poly_arcsin(a, n);
else
res = Poly::poly_arctan(a, n);
res.resize(n);
for (auto &x : res) cout << x << ' ';
}