{
haoi2009 moni4 t1
time:2009.4.24
}
program cch(input,output);
var
a:array[1..100] of integer;
n,k,tot:longint;
f:array[0..100] of longint;
procedure init;
begin
assign(input,'sort.in');
assign(output,'sort.out');
reset(input);
rewrite(output);
readln(n,k);
end;
procedure main;
var
i:longint;
begin
if k=1 then
begin
tot:=1; a[tot]:=0;
exit;
end;
dec(k);
f[n]:=1;
for i:=n-1 downto 1 do
f[i]:=f[i+1]*2;
i:=1; tot:=0;
repeat
if k<=f[i] then
begin
inc(tot); a[tot]:=i;
dec(k);
end
else
k:=k-f[i];
inc(i);
until k=0;
end;
procedure print;
var
i:longint;
begin
for i:=1 to tot-1 do write(a[i],' ');
writeln(a[tot]);
close(input);
close(output);
end;
begin
init;
main;
print;
end.