#include <stdio.h>

int main() {
    int n, m, i;
    int arr;

    // Read the number of elements
    scanf("%d", &n);

    // Read the array elements
    for (i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    // Read number of positions to rotate
    scanf("%d", &m);

    // Check for negative input
    if (n < 0 || m < 0) {
        printf("Invalid Input\n");
        return 0;
    }

    // Modulo m if it's more than n
    m = m % n;

    // Print the rotated array
    for (i = 0; i < n; i++) {
        printf("%d ", arr[(n - m + i) % n]);
    }
    printf("\n");
    return 0;
}