// editor1
#include<stdio.h>
#include<stdlib.h>
struct t{
    int data;
    struct t *l;
    struct t *r;
};
struct t* create(int val){
    struct t* n=(struct t*)malloc(sizeof(struct t*));
    n->data=val;
    n->l=NULL;
     n->r=NULL;
     return node;
}
struct t* insert(struct t* root,int val){
    if(root==NULL)
    return create(val);
    if(val<root->data)
        root->left=insert(root->left,val);
    else
        root->right=insert(root->right,val);
    return root;
}
void in(struct t* root){
    if(root==NULL)
    return;
    in(root->left);
    printf("%d ",root->data);
    in(root->right);
}
int main(){
    int n,x,nu;
    struct t* root=NULL;
    scanf("%d",&n);
    scanf("%d",&x);
    if(n<0 || x<0){
        printf("Invalild input");
        return 0;
    }for(int i=0;i<n;i++){
        scanf("%d",&nu);
        root=insert(root,nu);
    }
    root=insert(root,x);
    return 0;
}