#include<stdio.h>
#include<stdlib.h>
struct Node{
    int data;
    struct Node*next;
};
int main(){
    int N,P;
    struct Node*head=NULL,*tail=NULL,*temp,*prev;
    scanf("%d",&N);
    if(N<=0){
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<N;i++){
        temp=(struct Node*)malloc(sizeof(struct Node));
        scanf("%d",&temp->data);
        temp->next=NULL;
        if(head==NULL){
            head=tail=temp;
        }else{
            tail->next=temp;
            tail=temp;
        }
    }
    scanf("%d",&P);
    if(P<0 || P>=N){
        printf("Invaild input");
        return 0;
    }
    if(P==0){
        temp=head;
        head=head->next;
        free(temp);
    }
    else
    {
        prev=head;
        for(int i=0;i<P-1;i++){
            prev=prev->next;
        }
        temp=prev->next;
        prev->next=temp->next;
        free(temp);
    }
    temp=head;
    while(temp != NULL){
        printf("%d ",temp->data);
        if(temp->next !=NULL)
        printf("%d ",&s);
        temp=temp->next;
    }
    return 0;
}