//根据给定开始排序位置排序
#include <stdio.h>
#include <stdlib.h>
#define MAXN 100
//核心
void insertsort(int array[],int first,int last)//first前为有序部分,first为第一个无序部分,last为数组界限
{
int temp;
int location;//当前判断后不后移的位置
for(int i=first;i<=last;i++){
temp=array[i];
location=i-1;
while(location>=0&&array[location]>temp){
array[location+1]=array[location];
location--;
}
if(location!=i-1)
array[location+1]=temp;
}
return;
}
int main()
{
int array[MAXN];
for(int i=0;i<MAXN;i++)
scanf("%d",&array[i]);
int sortlocation;
scanf("%d",&sortlocation);
insertsort(array,sortlocation,MAXN-1);
for(int i=0;i<MAXN;i++)
printf(" %d",array[i]);
return 0;
}