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