#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
vector<int>a;
// write your code here......
cin>>n>>k;
for(int i=0;i<n;i++)
{
int t;
cin>>t;
a.push_back(t);
}
//注意是end()-1
for(vector<int>::iterator it=a.end()-1;it>=a.end()-k;it--)
{
cout<<*it<<" ";
}
return 0;
}