#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
using namespace std;
const int MAXN = 1e6 + 10;
#define M_PI 3.14159265358979323846
struct CP
{
double real, imaginary;
CP() { }
inline CP(const double &a, const double &b): real(a), imaginary(b) { }
inline CP operator + (const CP &r) const {return CP(real + r.real, imaginary + r.imaginary);}
inline CP operator - (const CP &r) const {return CP(real - r.real, imaginary - r.imaginary);}
inline CP operator * (const CP &r) const {return CP(real * r.real - imaginary * r.imaginary, real * r.imaginary + imaginary * r.real);}
inline CP conj() {return CP(real, -imaginary);}
};
CP a[MAXN], b[MAXN], t;
inline void _read(int &x)
{
x = 0;
char t = getchar();
while (!isdigit(t)) t = getchar();
while (isdigit(t))
{
x = x * 10 + t - '0';
t = getchar();
}
}
inline void print(int x)
{
if (x == 0) return putchar(48), void();
register int len = 0;int dg[20];
while (x) dg[++len] = x % 10, x /= 10;
for (register int i = len; i >= 1; i--) putchar(dg[i] + 48);
}
inline void swap(CP &a, CP &b)
{
t = a, a = b, b = t;
}
inline void FFT(CP *a, const int &n, const int &f)
{
for (register int i = 0, j = 0; i < n; ++i)
{
if (i > j) swap(a[i], a[j]);
for (register int k = n >> 1; (j ^= k) < k; k >>= 1);
}
for (register int i = 1; i < n; i <<= 1)
{
CP wn(cos(M_PI / i), f * sin(M_PI / i));
for (register int j = 0; j < n; j += i << 1)
{
CP w(1, 0);
for (register int k = 0; k < i; ++k, w = w * wn)
{
CP x = a[j + k], y = w * a[i + j + k];
a[j + k] = x + y, a[i + j + k] = x - y;
}
}
}
if (f == -1) for (register int i = 0; i < n; ++i) a[i].real /= (double)n;
}
int n, m;
int main()
{
_read(n), _read(m);
for (register int i = 0, x; i <= n; ++i) _read(x), a[i].real = x;
for (register int i = 0, x; i <= m; ++i) _read(x), a[i].imaginary = x;
for (m += n, n = 1; n <= m; n <<= 1);
FFT(a, n, 1);
CP Q(0, -0.25);
for (register int i = 0, j; i < n; ++i) j = (n - i) & (n - 1), b[i] = (a[i] * a[i] - (a[j] * a[j]).conj()) * Q;
FFT(b, n, -1);
for (register int i = 0; i <= m; ++i) print(int(b[i].real + 0.2)), putchar(' ');
return 0;
}