program dataa;
Type
fxz1=array[0..100] of integer;
var
f1,f2:text;
m,n,step,j,i,p:longint;
zuhe:array[1..100]of fxz1;
procedure paidui(i,x:integer);
var
k,q:integer;
begin
if i=m then begin inc(step);zuhe[step][m]:=x;zuhe[step+1]:=zuhe[step];end
else begin for k:=zuhe[step+1][i-1] to (x div (m-(i-1)))do
begin zuhe[step+1][i]:=k;;paidui(i+1,x-k);end;
end;
end;
begin
assign(f1,'dataa.in');
assign(f2,'dataa.out');
reset(f1);rewrite(f2);
readln(f1,n,m);
step:=0;
for i:=1 to 100 do
zuhe[i][0]:=1;
paidui(1,n);
writeln(f2,step);
for i:=1 to step do
begin for j:=1 to m do
write(f2,zuhe[i][j],' ');writeln(f2);end;
close(f1);close(f2);
end.