#include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
int main()
{
int n,x;
scanf("%d%d",&n,&x);
struct node *head=(struct node *)malloc(sizeof(struct node));
if(head==NULL)
exit(1);
head->next=NULL;
struct node *box=head;
for(int i=0;i<n;i++)
{
struct node *temp=(struct node *)malloc(sizeof(struct node));
if(temp==NULL)
exit(1);
scanf("%d",&temp->data);
temp->next=NULL;
box->next=temp;
box=box->next;
}
box=head->next;
struct node *t=head;
while(box!=NULL)
{
if(box->data==x)
{
t->next=box->next;
free(box);
t=t->next;
box=box->next->next;
}
else{
t=t->next;
box=box->next;
}
}
box=head->next;
while(box!=NULL)
{
printf("%d ",box->data);
box=box->next;
}
return 0;
}