program can;
var
i,j,r,n:longint;
a:array[-1..1000] of longint;
begin
assign(input,'compages.in');reset(input);
assign(output,'compages.out');rewrite(output);
read(n,r);
for i:=r downto 1 do
a[i]:=i;
for j:=1 to r do
write(a[j],' ');
writeln;
repeat
i:=r;
while a[i]=n-r+i do dec(i);
if i<=0 then exit;
inc(a[i]);
for j:=i+1 to r do
a[j]:=a[j-1]+1;
for j:=1 to r do
write(a[j],' ');
writeln;
until i=0;
close(input);close(output);
end.