#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node* next;
};
struct node* head=NULL;
struct node* temp;
void create(int data){
    struct node* newnode=(struct node*)malloc(sizeof(struct node));
    newnode->data=data;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
    }
    else{
        temp=head;
        while(temp->next!=NULL){
            temp=temp->next;
        }
        temp->next=newnode;
    }
    
}
void prune(int maxheight){
    while(head!=NULL && head->data>maxheight){
        temp=head;
        head=head->next;
        free(temp);
    }
    struct node* current=head;
    while(current!=NULL && current->next !=NULL){
        if(current->next->data>maxheight){
            temp=current->next;
            current->next=current->next->next;
            free(temp);
        }
        else{
            current=current->next;
        }
    }
}
void display(){
    temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
    if(head==NULL){
        printf("Empty");
        return 0;
    }
    
}
int main(){
    int n,data,maxheight;
    if(scanf("%d",&n)!=1 || n<=0){
        printf("Invalid input");
        return ;
        
    }
    for(int i=0;i<n;i++){
        if(scanf("%d",&data)!=1||data<0){
            printf("Invalid input");
            return 0;
        }
        create(data);
    }
    if(scanf("%d",&maxheight)!=1 || maxheight<0){
        return 0;
        
    }
    prune(maxheight);
    display();
    return 0;
}