1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <bits/stdc++.h>

using namespace std;

int a[2123456];

int main() {
    int n, t; scanf("%d%d", &n, &t);
    for (int i = 0; i < (1<<n); i++) scanf("%d", &a[i]);
    for (int i = 0; i < (1<<n); i++) printf("%d ", a[i^((t%2)*((1<<n)-1))]);
    printf("\n");
    return 0;
}