import strutils, sequtils, algorithm, math var nm = split(readLine(stdin), ' ').map(parseInt) c_seq = split(readLine(stdin), ' ').map(parseInt) count = 0 c_seq.sort(cmp[int]) for i, c in c_seq: count += c if count > nm[1]: echo(i) break if count == nm[1]: echo(i + 1) break