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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cstdio>

#define MAX_N 1048590
//?ok?

using namespace std;
typedef long long ll;

ll n;
ll t;




ll a[MAX_N];


int main()
{
	ios_base::sync_with_stdio(false);
	
	cin >> n >> t;
	
	ll num = 1;
	ll nc = n;
	
	while(nc > 0)
	{
		num *= 2;
		nc--;
	}
		
	for(ll i = 0; i < num; i++)
	{
		cin >> a[i];	
	}
	
	if(t%2 == 1)
	{
		for(ll i = num-1; i > 0; i--)
		{
			cout << a[i] << " ";
		}
		cout << a[0] << endl;
	}
	else
	{
		for(ll i = 0; i < num-1; i++)
		{
			cout << a[i] << " ";
		}
		cout << a[num-1] << endl;
	}
	
	
	return 0;
}