program datta;
var n,n2,m:integer;
di,ddo:text;
x1,x2:longint;
js:longint;
jiegou:array[1..6] of integer;
jg:array[1..10000] of integer;
t,s:integer;
procedure go(a:integer);
var x:integer;
begin
if n<>0 then
for x:=a to n do
begin
jiegou[t]:=x;
n:=n-x;
if (n>0)and(t<>m) then
begin
t:=t+1;
go(x);
end;
if (t=m) and (n=0) then
begin
js:=js+1;
for x2:=1 to m do
begin
jg[s]:=jiegou[x2];
s:=s+1;
end;
end;
n:=n+x;
end;
t:=t-1;
end;
begin
assign(di,'dataa.in');
reset(di);
read(di,n,m);
close(di);
assign(ddo,'dataa.out');
rewrite(ddo);
t:=1;
js:=0;
s:=1;
go(1);
writeln(ddo,js);
s:=s-1;
for x2:=1 to s do
begin
write(ddo,jg[x2]);
if (x2 mod m=0) and (x2<s) then
writeln(ddo);
if x2 mod m<>0 then
write(ddo,' ');
end;
close(ddo);
end.