#include<stdio.h>
#include<stdlib.h>
struct Node 
{
int data;
struct Node*next;
};
struct Node* insert(struct Node*head,int data)
{
    struct Node*newNode=(struct Node*)malloc (sizeof(struct Node));
    newNode->data=data;
    newNode->next=NULL;
    if(head==NULL)return newNode;
    struct Node*temp=head;
    while(temp->next!=NULL)temp=temp->next;
    temp->next=newNode;
    return head;
}
struct Node*deleteNode(struct Node*head,int position)
{
    if(head==NULL)return NULL;
    if(position==0)
    {
        struct Node*temp=head;
        head=head->next;
        free(temp);
        return head;
    }
    struct Node*temp=head;
    for(int i=0;temp!=NULL&&i<position-1;i++)
    {
        temp=temp->next;
    }
    if(temp==NULL||temp->next==NULL)return head;
    struct Node*next=temp->next->next;
    free(temp->next);
    temp->next=next;
    return head;
}
void printList(struct Node*head)
{
    while(head!=NULL)
    {
        printf("%d",head->data);
        head=head->next;
    }
}
int main(){
int N,P,data;
if(scanf("%d",&N)!=1||N<0||N>100)
{
    printf("Invalid input");
    return 0;
}
struct Node*head==NULL;
for(int i=0;i<N;i++)
{
    if(scanf("%d",&data)!=1||data<1||data>1000)
    {
            printf("Invalid input");
            return 0;
    }
    head=insert(head,data);
}
 if(scanf("%d",&P)!=1||P<0||P>=N||head==NULL){
     printf("Invalid input");
            return 0;
     
 }
 head=deleteNode(head,P);
 printList(head);
 return 0;
}