1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>
#include <cstdio>
using namespace std;

int n, t;
int a[(1 << 20) + 7];

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n >> t;
	n = (1 << n);
	if(t & 1) for(int i = 1; i <= n; ++i) cin >> a[n - i];
	else for(int i = 0; i < n; ++i) cin >> a[i];
	for(int i = 0; i < n; ++i) cout << a[i] << ' ';
	cout << endl;
	return 0;
}