// editor4
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);

    int arr[1005];
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    int pos, val;
    scanf("%d", &pos);
    scanf("%d", &val);

    // Invalid position check
    if (pos > n || pos < 0) {
        printf("Invalid input");
        return 0;
    }

    // Shift elements to the right
    for (int i = n; i > pos; i--) {
        arr[i] = arr[i - 1];
    }

    // Insert new value
    arr[pos] = val;
    n++;

    // Print updated list
    for (int i = 0; i < n; i++) {
        printf("%d", arr[i]);
        if (i != n - 1) printf(" ");
    }

    return 0;
}