#include<iostream>
using namespace std;
const int N=1001;
void reverse(int a[], int size){
for(int i=(size-1);i>=0;i--) cout<<a[i]<<" ";
}
int main(){
int a[N],size,n;
cin>>n>>size;
for(int i=0;i<n;i++) cin>>a[i];
reverse(a,size);
for(int i=size;i<n;i++) cout<<a[i]<<" ";
return 0;
}