1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, t, tab[1000010];
int main()
{
	ios_base::sync_with_stdio( 0 );
	cin.tie( 0 );
	cin>>n>>t;
	n = 1<<n;
	for( int a = 1; a <= n; a++ )cin>>tab[a];
	if( t%2 )for( int a = n; a >= 1; a-- )cout<<tab[a]<<" ";
	else for( int a = 1; a <= n; a++ )cout<<tab[a]<<" ";
	return 0;
}