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
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define FOR(i,n) for(int i=0;i<n;++i)
#define FORB(i,b,n) for(int i=b;i<n;++i)
#define REV(i,n) for(int i=n;i>=0;--i)
#define FOREACH(T, it, v) for(T::iterator it = v.begin(); it !=v.end(); ++it)

typedef unsigned int u32;
typedef unsigned int uint;
const int INF = (0u - 11) / 2;

typedef long long ll;
typedef set<int> SI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef set<long long> SL;
typedef map<int, int> MII;



int DEBUG = 1;

#define print(STRING,INT) printf("%s= %d\n", STRING, INT)

#define scan(INT) scanf("%d", &INT)


void log(char* S, int a)
{
	if (DEBUG)
	{
		print(S, a);
	}
}

const int MAX_SHORT = 65536;

const int MEMORY_SECTOR_SIZE = 1000012;





int Win[MEMORY_SECTOR_SIZE];
int Draw[MEMORY_SECTOR_SIZE];


void zadanieKAR()
{
	int N, M;
	int a, b;
	char c;
	scan(N);
	scan(M);
	FOR(i, N + 1)
	{
		Win[i] = 0;
		Draw[i] = 0;
	}
	FOR(i, M)
	{
		scanf("%d %c %d", &a, &c, &b);
		if (c == '>')
		{
			Win[b]++;
			if (Win[b] == N)
			{
				printf("WYGRANA\n");
				return;
			}
		}
		else
		{
			Draw[b]++;
		}
	}
	FORB(i, 1, N + 1)
	{
		if (Draw[i] == 0)
		{
			printf("REMIS\n");
			return;
		}
	}
	printf("PRZEGRANA\n");
}


int main1A()
{
	//int nodes = NumberOfNodes();
	int n;
	scan(n);
	FOR(i, n)
	{
		zadanieKAR();
	}
	//printf("%d\n", out);
	return 0;
}

int main1B()
{
	int n;
	int t;
	scan(n);
	n = 1 << n;
	scan(t);
	vector<int> V(n, 0);
	FOR(i, n)
	{
		scan(V[i]);
	}
	if (t & 0x1)
	{
		std::reverse(V.begin(), V.end());
	}
	FOR(i, n)
	{
		printf("%d ", V[i]);
	}
	printf("\n");
	return 0;
}

int main()
{
	main1B();
	return 0;
}