#include <bits/stdc++.h>
using namespace std;
typedef complex <double> cp;
const int N = 1e6 + 10;
const double PI = acos(-1);
int n = 1, lena, lenb, ans[N];
cp a[N], b[N], omg[N], inv[N];
inline void init(){
for (int i = 0; i < n; i++){
omg[i] = cp(cos(2 * PI * i / n), sin(2 * PI * i / n));
inv[i] = conj(omg[i]);
}
}
inline void fft(cp *a, cp *omg){
int lim = 0;
while ((1 << lim) < n) ++lim;
for (int i = 0; i < n; i++){
int t = 0;
for (int j = 0; j < lim; j++)
if (i & (1 << j)) t |= (1 << (lim - j - 1));
if (t < i) swap(a[t], a[i]);
}
for (int l = 2; l <= n; l <<= 1){
int m = l / 2;
for (cp *p = a; p != a + n; p += l){
for (int i = 0; i < m; i++){
cp t = omg[n / l * i] * p[i + m];
p[i + m] = p[i] - t;
p[i] += t;
}
}
}
}
int main(){
scanf("%d %d", &lena, &lenb);
++lena, ++lenb;
int x;
for (int i = 0; i < lena; i++){
scanf("%d", &x);
a[i].real(x);
}
for (int i = 0; i < lenb; i++){
scanf("%d", &x);
b[i].real(x);
}
while (n < lena + lenb) n <<= 1;
init();
fft(a, omg);
fft(b, omg);
for (int i = 0; i < n; i++) a[i] *= b[i];
fft(a, inv);
for (int i = 0; i < n; i++)
a[i].real() = abs(a[i].real() / n);
for (int i = 0; i < lena + lenb - 1; i++) printf("%.0lf ", a[i].real());
return 0;
}