1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <bits/stdc++.h>
using namespace std;
int n,t,x;
vector <int> V;
int main(){
ios_base::sync_with_stdio(false);
cin>>n>>t;
while (cin>>x) V.push_back(x);
if (t%2==0) for (int i=0; i<V.size(); i++) cout<<V[i]<<" ";
else        for (int i=V.size()-1; i>=0; i--) cout<<V[i]<<" ";
return 0;

}