i,j,w[];c(int*a,int*b){return*a-*b;}main(){for(;~scanf("%d",w+i++););qsort(w+2,*w,4,c);for(;w[1]--;j+=!--w[j+2]);j=!printf("%d",j);}