def solve(l,w) s = 0 w.sort.find_index {|v| s += v l < s } || w.size end l = gets.to_i n = gets.to_i w = gets.split.map(&:to_i) p solve(l,w)