// editor2
#include<stdio.h>
#include<stdlib.h>
typede struct node{
    int data;
    struct node*next;
} Node;
Node *head = NULL, *tail = NULL;
 void create(int num){
     Node *newNode = (Node*)malloc(sizeof(Node));
     newNode->data = num;
     newNode->next = NULL;
     if(head == NULL)
        head = tail = newNode;
      else{
          tail->next = newNode;
          tail = newNode;
      }
 }
 
 int main(){
     int N;
     if(scanf("%d",&N) != 1 || N<0 || N>100){
         printf("Invaalid input");
         return 0;
     }
     if(N == 0){
         printf("Invalid input");
         return 0;
     }
     for(int i=0; i<N ;i++){
         int num;
         if(scanf("%d",&num) !=1 || num<1 || num>1000){
             printf("Invalid input");
             return 0;
         }
         create(num);
     }
     int P;
     if(scanf("%d",&P) !=1 || P<0  || P >=N){
         printf("Invalid input");
         return 0;
     }
     Node*tep = head;
     if(P == 0){
         head = head->next;
         free(temp);
     }
     else{
         for(int i=0;i<P-1; i++){
             temp = temp->next;
         }
         Node*del = temp->next;
         temp->next = del->next;
         if(del == tail)
          tail = temp;
          free(del);
     }
     temp = head;
     while(temp != NULL){
         printf("%d",temp->data);
         temp = temp->next;
         if(temp != NULL)
          printf(" ");
     }
     
     return 0;
 }