#include #include using namespace std; using mint = atcoder::modint998244353; #include using Bint = boost::multiprecision::cpp_int; int main(){ ios::sync_with_stdio(false); cin.tie(0); int m, n; cin >> m >> n; Bint tmp = 0, d = 1; for(int i = 0; i <= m; i++){ int v; cin >> v; tmp += v * d; d *= 1009; } n++; vector a(n); for(int i = 0; i < n; i++){ int v; cin >> v; a[i] = v; } vector b(n); b[0] = 1; while(tmp >= 1){ if(tmp & 1){ b = convolution(b, a); b.resize(n); for(int i = 0; i < n; i++){ b[i] = b[i].val() % 1009; } } a = convolution(a, a); a.resize(n); for(int i = 0; i < n; i++){ a[i] = a[i].val() % 1009; } tmp >>= 1; } for(int i = 0; i < n; i++){ cout << b[i].val() << (i + 1 == n ? '\n' : ' '); } }