#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(){
	int n,k;
	vector<int>a;
	// write your code here......
	cin>>n;
	cin>>k;
	int in = 0;
	for (int i = 0; i < n; i++)
	{
		cin>>in;
		a.push_back(in);
	}
	auto it = a.rbegin();
	for (int i =0; i < k; i++)
	{
		cout << *it << " ";
		it++;
	}
	return 0;
}