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