#include<stdio.h>
typedef struct link{
    int elem;
    struct link *next;
}link,*linklist;
int main(){
    int n,i,j;
    scanf("%d %d",&n,&i);
    int a[n];
    link *p=(link*)malloc(sizeof(link));
    link *temp=p;
    for(j=0;j<n;j++){
        scanf("%d",&a[j]);
    }
    for(j=0;j<i;j++){//插入前面的
        link *s=(link*)malloc(sizeof(link));
        s->elem=a[j];
        s->next=NULL;
        temp->next=s;
        temp=temp->next;
    }
    link *s=(link*)malloc(sizeof(link));
    s->elem=i;
    s->next=NULL;
    temp->next=s;
    temp=temp->next;
    for(j=i;j<n;j++){//插入剩下的
        link *s=(link*)malloc(sizeof(link));
        s->elem=a[j];
        s->next=NULL;
        temp->next=s;
        temp=temp->next;
    }
    temp=p;
    while(temp->next){
        temp=temp->next;
        printf("%d ",temp->elem);
    }
}

因为对链表插入删除还不算很熟练,所以用了拆成两部分读入这种写法