1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <cstdio>

int A[2000000];
int N, T;

int main()
{
	scanf("%d%d", &N, &T);
	for (int i = 0; i < (1 << N); ++i)
		scanf("%d", A+i);

	if (T%2)
		for (int i = (1 << N) -1; i >=0; --i)
			printf("%d ", A[i]);
	else
		for (int i = 0; i < (1 << N); ++i)
			printf("%d", A[i]);
	return 0;
}