1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include<cstdio>
int n,m,i,a[1050000];
inline void read(int&a){char c;while(!(((c=getchar())>='0')&&(c<='9')));a=c-'0';while(((c=getchar())>='0')&&(c<='9'))(a*=10)+=c-'0';}
int main(){
  read(n),read(m);
  n=1<<n;
  for(i=1;i<=n;i++)read(a[i]);
  if(m&1)for(i=n;i;i--)printf("%d%c",a[i],i>1?' ':'\n');
  else for(i=1;i<=n;i++)printf("%d%c",a[i],i<n?' ':'\n');
  return 0;
}