1
 2
 3
 4
 5
 6
 7
 8
 9
10
program ziola;
var
 n,i,t:longint;
 x:array [1..1 shl 20] of longint;
begin
 readln(n,t); n:=1 shl n;
 for i:=1 to n do read(x[i]);
 if t mod 2=0 then for i:=1 to n do write(x[i],' ')
 else for i:=n downto 1 do write(x[i],' ');
end.