program dataa(input,output);
type
t1=array[1..21] of integer;
t2=array[1..100,1..100] of integer;
var
a:t1;
b:t2;
p,p0:boolean;
i,j,l,ans,n,m:integer;
f1,f2:text;
begin
assign(f1,'dataa.in');
reset(f1);
readln(f1,n,m);
close(f1);
repeat
l:=0;
p:=false;
a[m]:=a[m]+1;
for i:=m downto 1 do begin
a[i-1]:=a[i-1]+a[i] div 10;
a[i]:=a[i] mod 10;
l:=l+a[i];
end;
for i:=1 to m-1 do begin
if a[i]>a[i+1] then p:=true;
if a[i]=0 then p:=true;
end;
if (p=false)and(l=n) then begin
inc(ans);
for i:=1 to m do b[ans,i]:=a[i];
end;
p0:=false;
for i:=1 to m do begin
if a[i]<>9 then p0:=true;
end;
until p0=false;
assign(f2,'dataa.out');
rewrite(f2);
writeln(f2,ans);
for i:=1 to ans do begin
for j:=1 to m do write(f2,b[i,j],' ');
writeln(f2);
end;
close(f2);
end.