def g;gets.split.map(&:to_i)end n,m=g c=g.sort p (0...n).find{|i|(m-=c[i])<0}||n