#include <iostream>

using namespace std;

int main()
{
	int n , k , y, z,x;
	int i=0;
	cin >> n >> k;
	int a[n];
	int b[n];
	while (i < n)
	{
		cin >> a[i];
		i++;
	}
	i = 0;
	x = 0;
	while (x < k)
	{
		i = 0;

		while (i < n-1)
		{
			b[i+1] = a[i];
			i++;
		}
		b[n-1-i] = a[i];
		i=0;
		while(i < n)
		{
			a[i] = b[i];
			i++;
		}
		
		x++;
	}	
	
	i = 0;
	while (i < n)
	{
		cout << a[i] <<" ";
		i++;
	}			

	return 0;
}