#include <iostream>
using namespace std;
int main()
{
    int n, x;
    cin >> n >> x;
    int arr1[n];

    for (int i = 0; i < n; i++)
    {
        cin >> arr1[i];
    }

    int a = 0;
    int min = arr1[a];
    int counter = 0;
    while (x > min && a < n)
    {
        a++;
        counter++;
        min = arr1[a];
    }

    int arr2[n + 1];
    for (int i = 0; i < counter - 1; i++)
    {
        arr2[i] = arr1[i];
    }

    arr2[counter] = x;

    for (int i = counter + 1; i < n + 1; i++)
    {
        arr2[i] = arr1[i - 1];
    }

    for (int i = 0; i < n + 1; i++)
    {
        cout << arr2[i] << " ";
    }

    return 0;
}