#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
const double pi = acos(-1.0);
struct Complex {
double x, y;
Complex operator + (Complex b) { return (Complex) { x + b.x, y + b.y }; }
Complex operator - (Complex b) { return (Complex) { x - b.x, y - b.y }; }
Complex operator * (Complex b) { return (Complex) { x * b.x - y * b.y, x * b.y + y * b.x }; }
} F[N << 1], G[N << 1];
void FFT(Complex *f, int len, double type) {
if (len == 1) return ;
Complex fl[len >> 1], fr[len >> 1];
for (int i = 0; i <= len; i ++) {
if (i & 1) fr[i >> 1] = f[i];
else fl[i >> 1] = f[i];
}
FFT(fl, len >> 1, type), FFT(fr, len >> 1, type);
Complex w1 = (Complex) { cos(2.0 * pi / len), sin(2.0 * pi / len) * type }, w = (Complex) { 1, 0 };
for (int i = 0; i < (len >> 1); i ++, w = w * w1) {
f[i] = fl[i] + fr[i] * w;
f[i + (len >> 1)] = fl[i] - fr[i] * w;
}
}
int main () {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n, m; cin >> n >> m;
for (int i = 0; i <= n; i ++) cin >> F[i].x;
for (int i = 0; i <= m; i ++) cin >> G[i].x;
int len = 1;
while (len <= n + m) len <<= 1;
FFT(F, len, 1.0); FFT(G, len, 1.0);
for (int i = 0; i <= len; i ++)
F[i] = F[i] * G[i];
FFT(F, len, -1.0);
for (int i = 0; i <= n + m; i ++)
cout << (int)(F[i].x / len + 0.5) << " ";
}