#include <iostream>
#include <math.h>
using namespace std;
#define PI 3.1415926535897932384626
class cmpl{//complex
public:
double x,y;//x+yi
public:
cmpl()
{
x=0,y=0;
}
cmpl(double x1,double y1)
{
x=x1,y=y1;
}
~cmpl()
{
;
}
cmpl operator+(const cmpl&t)const
{
return cmpl(x+t.x,y+t.y);
}
cmpl operator-(const cmpl&t)const
{
return cmpl(x-t.x,y-t.y);
}
cmpl operator*(const cmpl&t)const
{
return cmpl(x*t.x-y*t.y,x*t.y+y*t.x);
}
cmpl operator/(const double t)const
{
return cmpl(x/t,y/t);
}
};
inline void FFT(cmpl *f,int len,short inv)
{
if(!len)return ;
cmpl f1[len+1],f2[len+2];
for(int i = 0;i < len;i ++)f1[i]=f[i<<1],f2[i]=f[i<<1|1];
FFT(f1,len>>1,inv);
FFT(f2,len>>1,inv);
cmpl tmp(cos(PI/len),inv*sin(PI/len)),first(1,0);
for(int i = 0;i < len;i ++)
{
cmpl t=first*f2[i];
f[i]=f1[i]+t,f[i+len]=f1[i]-t;
first=first*tmp;
}
}
int n,m,s;
const int maxn=6e6+7;
cmpl a[maxn],b[maxn];
int main(void)
{
cin>>n>>m;
for(int i = 0;i <= n;i ++)cin>>a[i].x;
for(int i = 0;i <= m;i ++)cin>>b[i].x;
m+=n;
for(n = 1;n < m;n <<= 1);
FFT(a,n>>1,1);
FFT(b,n>>1,1);
for(int i = 0;i <= n;i ++)a[i]=a[i]*b[i];
FFT(a,n>>1,-1);
for(int i = 0;i <= m;i ++)cout<<(int)(a[i].x/n+0.5)<<" ";
return 0;
}