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