1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<bits/stdc++.h>
#define FORD(x, b, e) for(int x=b;x>=(e);x--)
#define REP(x, n)     for(int x=0;x<(n);x++)
using namespace std;
const int MXN = (1<<20) + 4;
int in[MXN];
int main()
{
int n, t;
scanf("%d%d", &n, &t);
n = 1<<n;
REP(i, n)
  scanf("%d", &in[i]);
if(t % 2 == 0)
  {
  REP(i, n)
    printf("%d ", in[i]);
  }
else
  {
  FORD(i, n-1, 0)
    printf("%d ",in[i]);
  }
}