#include <stdio.h>
#define NMAX 10
int check_tail(void);
int input(int *a, int *n, int *shift);
void cycle_shift(int *a, int n, int shift);
void output(int *a, int n);
int main(void) {
int n;
int shift;
int data[NMAX];
if (input(data, &n, &shift)) {
cycle_shift(data, n, shift);
output(data, n);
} else {
printf("n/a");
}
return 0;
}
int check_tail(void) {
int ch;
int result = 1;
while ((ch = getchar()) != '\n' && ch != EOF) {
if (ch != ' ' && ch != '\t') {
result = 0;
}
}
return result;
}
int input(int *a, int *n, int *shift) {
int result = 1;
int i = 0;
if (scanf("%d", n) != 1 || *n <= 0 || *n > NMAX) {
result = 0;
}
while (result && i < *n) {
if (scanf("%d", a + i) != 1) {
result = 0;
}
i++;
}
if (result && scanf("%d", shift) != 1) {
result = 0;
}
if (result && !check_tail()) {
result = 0;
}
return result;
}
void cycle_shift(int *a, int n, int shift) {
int result[NMAX];
int i = 0;
int real_shift;
real_shift = shift % n;
if (real_shift < 0) {
real_shift = real_shift + n;
}
while (i < n) {
*(result + i) = *(a + (i + real_shift) % n);
i++;
}
i = 0;
while (i < n) {
*(a + i) = *(result + i);
i++;
}
}
void output(int *a, int n) {
int i = 0;
while (i < n) {
if (i > 0) {
printf(" ");
}
printf("%d", *(a + i));
i++;
}
}