import sequtils,strutils,math,algorithm var N,M : int cnt : int (N, M) = stdin.readline.split.map(parseInt) var C = stdin.readline.split.map(parseInt) C.sort(system.cmp) for c in C: M -= c if M >= 0: cnt += 1 else: break echo cnt