#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }

    int chortke[10001];
    memset(chortke, 0, sizeof(chortke));

    for (int i = n - 1; i >= 0; i--)
    {
        if (k + i >= n)
        {
            chortke[(i + k) % n] = arr[i];
        }
        else
        {
            chortke[i + k] = arr[i];
        }
    }

    for (int i = 0; i < n; i++)
    {
        cout << chortke[i] << " ";
    }
    return 0;
}