#include <iostream>
using namespace std;
void solve (int a[], int n, int k) {
for (int i=0; i<n; i++) {
cout << a[(i+k)%n] << " ";
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, k; cin >> n >> k;
int a[n];
for (int i=0; i<n; i++) cin >> a[i];
solve (a, n, k%n);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBzb2x2ZSAoaW50IGFbXSwgaW50IG4sIGludCBrKSB7Cglmb3IgKGludCBpPTA7IGk8bjsgaSsrKSB7CgkJY291dCA8PCBhWyhpK2spJW5dIDw8ICIgIjsKCX0KfQogCmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKG51bGxwdHIpOwogICAgCiAgICBpbnQgbiwgazsgY2luID4+IG4gPj4gazsKICAgIGludCBhW25dOyAKICAgIGZvciAoaW50IGk9MDsgaTxuOyBpKyspIGNpbiA+PiBhW2ldOyAKCXNvbHZlIChhLCBuLCBrJW4pOwp9