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