program chik;
var a,b:array[1..1000]of longint;
c:array[1..1000,1..1000]of longint;
n,m,i,j:longint;
begin
read(n,m);
for i:=1 to n do
begin
read(a[i]);
end;
for i:=1 to m do
begin
read(b[i]);
end;
for i:=1 to n do
begin
for j:=1 to m do
begin
c[i,j]:=a[i]+b[j];
end;
end;
for i:=1 to n do
begin
for j:=1 to m do
begin
write(c[i,j]:3,' ');
end;
writeln;
end;
end.