#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 andix = 0;
    int a = 0;
    while ( arr1[a] < x )
    {
        a ++; 
        andix ++;
    }

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

        else if ( x > arr1[n - 1] )
        {
            arr2[0] = arr1[0];
            arr2[i] = arr1[i];
            arr2[n] = x;
        }
    }

    for ( int i = 0 ; i < n ; i ++ )
    {
        if ( arr1[i] < x && arr1[n - 1] > x )
        {
            arr2[i] = arr1[i];
            arr2[andix] = x;
        }

        else if ( arr1[i] > x && arr1[0] < x )
        {
            arr2[i + 1] = arr1[i];
            arr2[andix] = x;
        }
    }


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

    return 0;
}