#include <stdio.h>

int main() 
{
    int n, m;
    int arr[51] = {0};
    scanf("%d", &n);
    for (int i = 0; i < n; i++) 
    {
        scanf("%d", &arr[i]);
    }
    scanf("%d",&m);
    for(int i=n-1;i>=0;i--)
    {
        if(m<arr[i])
        {
            arr[i+1]=arr[i];
        }
        else
        {
            arr[i+1]=m;
            break;
        }
    }
    if(arr[0]>m)
    {
        arr[0]=m;
    }
    for(int i=0;i<n+1;i++)
    {
        printf("%d ",arr[i]);
    }
        return 0;
}