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
#include <vector>
#include <cstdio>
using namespace std;


int main() {
    int n,t;
    scanf("%d %d", &n, &t);
   
    int q = 1;
    
    while(n--){
        q*=2;
    }

    vector <int> v;
    for (int i=0; i<q; i++) {
        int a;
        scanf ("%d", &a);
        v.push_back(a);
    }

    if (t%2) {
        for (int i=q-1; i>=0; i--)
            printf("%d ", v[i]);
    } else {
        for (int i=0; i<q; i++)
            printf("%d ", v[i]);
    }
    printf("\n");
    return 0;
}