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
28
29
30
31
32
33
34
35
36
37
38
#include<bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<=(e);i++)
#define FORD(i,s,e) for(int i=(s);i>=(e);i--)
#define FOREACH(i,c) for( __typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define ALL(k) (k).begin(),(k).end()
#define e1 first 
#define e2 second
#define mp make_pair
#define pb push_back
#define eb emplace_back 
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
const bool print=false;
const int MAXN=2000111;
int t[MAXN];
/*int readint(){
	char a=getchar_unlocked();
	while(a<'0'||a>'9') a=getchar_unlocked();
	int wyn=0;
	while('0'<=a&&a<='9') wyn=10*wyn+a-'0',a=getchar_unlocked();
	return wyn;
}
char readsgn(){
	char a=getchar_unlocked();
	while(a!='<'&&a!='>') a=getchar_unlocked();
	return a;
}*/

main(){
	int n0,ts;scanf("%d%d",&n0,&ts);
	int n=1;FOR(i,1,n0) n*=2;
	FOR(i,1,n) scanf("%d",&t[i]);
	if(ts%2) reverse(t+1,t+n+1);
	FOR(i,1,n) printf("%d ",t[i]);
	puts("");
}