#include int main(void) { int block[10000]; int L,N,j,k,i=0; int a=0; scanf("%d",&L); while(L<1||L>10000){ scanf("%d",&L); } scanf("%d",&N); while(iblock[j]){ k=block[i]; block[i]=block[j]; block[j]=k; } } } i=0; if(N==1){ if(L>=block[0]){ printf("%d\n",1); } else{ printf("%d\n",0); } } else{ for(i=0;i=L){ printf("%d\n",i); break; } if(i==N-1){ printf("%d\n",N); } } } return 0; }