#include using namespace std; #define all(x) begin(x), end(x) #ifdef CKISEKI #define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n" #define debug(a...) debug_(#a, a) #define orange(a...) orange_(#a, a) #include void debug_(auto s, auto ...a) { cerr << "\e[1;32m(" << s << ") = ("; int f = 0; (..., (cerr << (f++ ? ", " : "") << a)); cerr << ")\e[0m\n"; } void orange_(auto s, auto L, auto R) { cerr << "\e[1;33m[ " << s << " ] = [ "; using namespace experimental; copy(L, R, make_ostream_joiner(cerr, ", ")); cerr << " ]\e[0m\n"; } #else #define safe ((void)0) #define debug(...) safe #define orange(...) safe #endif using lld = int64_t; int main() { constexpr int p = 1009; constexpr int p2 = p * p; constexpr lld mod = p * p * (p - 1); cin.tie(nullptr)->sync_with_stdio(false); int M, N; cin >> M >> N; const lld inf = 1e15; lld K_capped = 0, K_mod = 0; { vector k(M + 1); for (int i = 0; i <= M; i++) { cin >> k[i]; } for (int i = M; i >= 0; i--) { K_capped = min(inf, K_capped * p + k[i]); K_mod = (K_mod * p + k[i]) % mod; } } vector e(N + 1), r(N + 1); r[0] = 1; for (int i = 0; i <= N; i++) e[i] = rand() % p; // cin >> e[i]; auto mul = [&](const auto &a, const auto &b) { vector c(N + 1); for (int i = 0; i <= N; i++) { for (int j = 0; i + j <= N; j++) { c[i + j] += a[i] * b[j]; if (c[i + j] >= p2) c[i + j] -= p2; } } for (int i = 0; i <= N; i++) c[i] %= p; return c; }; // lld K = K_mod + (K_capped - K_mod) / mod * mod; lld K = K_mod; while (K) { if (K & 1) r = mul(r, e); e = mul(e, e); K >>= 1; } /* for (int i = 0; i <= N; i++) if (r[i] != 0) debug(i); */ for (int i = 0; i <= N; i++) cout << r[i] << (i==N ? '\n' : ' '); }