#include <stdio.h>
#include <stdlib.h>
struct node{
    int order;
    struct node* next;
}node;

int main()
{
    int n,k;
    struct node *temp;
    scanf("%d",&k);
    if(n-k==0)
    {
        printf("List is empty");
    }
    else if(n-k<0)
    {
        printf("Invalid input");
    }
    else
    {
        for(int i=0;i<n-k-1;i++)
        {
            temp=temp->next;
        }
    }
    struct node *t=temp;
    temp=temp->next;
    while(temp)
    {
        struct node *x=temp;
        temp=temp->next;
        free(x);
    }
    t->next=NULL;
    while(temp)
    {
        printf("%d ",temp->data);
    }
}