i=input;a=int(i());i();c=0;b=sum(a>=(c:=c+i)for i in sorted(map(int,i().split())))