n,m,*c=$<.read.split.map &:to_i s=0; c.sort!;p n.times{|i|s+=c[i];m>s||(break m