1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
program tas;

var
  n: byte;
  t1: longword;

  ilosc: longword;
  a: array[1..104857] of longword;
  i: longword;
  
begin
  readln(n,t1);

  ilosc := 2;
  for i:=1 to n-1 do
    ilosc := ilosc * 2;
  for i:=1 to ilosc do
    read(a[i]);
  if (t1 mod 2)>0 then
    for i:=ilosc downto 1 do
      write(a[i])
  else
    for i:=1 to ilosc do
      write(a[i]);
  writeln;

end.