program dataa;
var
n,m,i,j,d:integer;
f1,f2:text;
a:array[0..10]of integer;
s:array[1..1000]of string;
procedure try(i:integer);
var
k,h:integer;
s1:string;
begin
for k :=1 to n-m+1 do
begin
if (j>0)and(k>=a[i-1])and(i<=m) then begin
a[i]:=k;
j:=j-k;
if (i=m)and(j=0)then begin
inc(d);
for h:=1 to m do begin
str(a[h],s1);
s[d]:=s[d]+s1;
s[d]:=s[d]+' ';
end;
end
else try(i+1);
a[i]:=0;
j:=j+k;
end;
end;
end;
begin
assign(f1,'dataa.in');reset(f1);
assign(f2,'dataa.out');rewrite(f2);
read(f1,n,m);
for j:=1 to 1000 do s[j]:='';
j:=n;
fillchar(a,sizeof(a),0);
d:=0;
try(1);
writeln(f2,d);
for j:=1 to d do
writeln(f2,s[j]);
close(f2); close(f1);
end.