program ex;
var
n,m,i,i1,j,k,c:integer;
f1,f2:text;
a:array[1..100,1..100]of integer;
b:array[1..100] of integer;
procedure fen(x,y:integer);
var i:integer;
begin
for i:=x-y+1 downto x div y do
if (i>0)and(i<=c) then
begin x:=x-i ;y:=y-1;j:=j+1;b[j]:=i;c:=b[j];
if (y=0) then begin k:=k+1;a[k]:=b;end
else fen(x,y);
j:=j-1;y:=y+1;x:=x+i;c:=n;
end;
end;
begin
assign(f1,'dataa.in');reset(f1);
assign(f2,'dataa.out');rewrite(f2);
read(f1,n,m);
j:=0;k:=0; c:=n;
fen(n,m);
writeln(f2,k);
for i:=1 to k do begin
for i1:=m downto 1 do write(f2,a[i,i1]);
writeln(f2);
end;
close(f1);close(f2);
end.