#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
#define TYPE int
const int maxn=1e7+7;
typedef long long ll;
const int mod=1e9+7;
void Smax(TYPE &a,TYPE b){if(a<b) a=b;}
void Smin(TYPE &a,TYPE b){if(a>b) a=b;}
///#define getchar()(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
///char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
#define IO cin.tie(0),ios::sync_with_stdio(false);
#define pi acos(-1)
#define PII pair<ll,ll>
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
#define read read()
/** keep hungry and keep calm! **/
int limit=1,l,r[maxn];
void fft(complex<double> *a,int f){
for(int i=0;i<limit;i++){
if(i<r[i]){
swap(a[i],a[r[i]]);
}
}
for(int mid=1;mid<limit;mid<<=1){
complex<double>tmp(cos(pi/mid),f*sin(pi/mid));
for(int i=0;i<limit;i+=mid*2){
complex<double>now(1,0);
for(int j=0;j<mid;j++,now*=tmp){
complex<double>x=a[i+j],y=now*a[i+j+mid]; //蝴蝶变换
a[i+j]=x+y;a[i+j+mid]=x-y;
}
}
}
}
complex<double>a[maxn],b[maxn];
int Sheryang(){
int n=read,m=read;
for(int i=0;i<=n;i++){
a[i]=read;
}
for(int i=0;i<=m;i++){
b[i]=read;
}
while(limit<n+m+2) limit<<=1,l++; ///注意调整位数和到2的幂次
for(int i=0;i<limit;i++){
r[i]=(r[i>>1]>>1)|((i&1)<<(l-1)); //找到每个数二进制的翻转
}
fft(a,1);fft(b,1);
for(int i=0;i<=limit;i++){
a[i]=a[i]*b[i];
}
fft(a,-1);
for(int i=0;i<=n+m;i++){
printf("%d ",(int)(a[i].real()/limit+0.5));
}
return 0;
}