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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,t,N=1;
    cin >> n >> t;
    for(int i=0;i<n;++i) N<<=1;
    vector<int> V(N);
    for(int i=0;i<N;++i) cin >> V[i];
    if(t&1) for(int i=N-1;i>=0;--i) cout << V[i] << " ";
    else for(int i=0;i<N;++i) cout << V[i] << " ";
    cout << '\n';
}