program day4_1;
var
n,k: longint;
i: longint;
f: array[0..33] of qword;
ans: array[0..33] of longint;
procedure Init;
begin
readln(n,k); dec(k);
for i :=1 to n do f[i] :=1 shl (n-i);
for i :=1 to n do begin
if k=0 then break;
if k <=f[i] then begin
inc(ans[0]); ans[ans[0]]:=i;
dec(k)
end
else if k > f[i] then begin
dec(k,f[i]);
end;
end;
end;
procedure Print;
var
i: longint;
begin
for i :=1 to ans[0]-1 do write(ans[i],' ');
writeln(ans[ans[0]]);
end;
begin
assign(input,'sort.in'); reset(input);
assign(output,'sort.out'); rewrite(output);
Init;
Print;
close(input); close(output);
end.