1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <bits/stdc++.h>
using namespace std;

const int R = 1 << 20;

int a[R];

int main(){
	int n, t;
	scanf("%d%d",&n,&t);
	for(int i=0;i<(1<<n);i++)scanf("%d",&a[i]);
	if(t & 1)reverse(a, a+(1<<n));
	for(int i=0;i<(1<<n);i++)printf("%d ",a[i]);
	return 0;
}