program cojs26;
var
a:array[1..10] of longint;
f:array[1..100000,1..10] of longint;
i,j,k,m,n,ans:longint;
procedure dfs(x,sum:longint);
var
i,j,k:longint;
begin
if x=m then
begin
inc(ans);
for i:=1 to m-1 do
f[ans,i]:=a[i];
f[ans,m]:=n-sum;
exit;
end;
for i:=a[x-1] to (n-sum)div (m-x+1) do
begin
a[x]:=i;
dfs(x+1,sum+i);
end;
end;
begin
assign(input,'dataa.in');
assign(output,'dataa.out');
reset(input);
rewrite(output);
readln(n,m);
ans:=0;
for i:=1 to n div m do
begin
a[1]:=i;
dfs(2,i);
end;
writeln(ans);
for i:=1 to ans do
begin
for j:=1 to m-1 do
write(f[i,j],' ');
writeln(f[i,m]);
end;
close(input);
close(output);
end.