#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	vector<int>a;
	// write your code here......
	cin>>n>>k;
	int x;

	for(int i=0;i<n;i++)
	{
		cin>>x;
		a.push_back(x);

	}



	

	for(auto it=a.end()-1;it!=a.end()-k-1;it--)
	{
		cout<<*it<<" ";
	}
	
	return 0;
}