from itertools import accumulate
from bisect import bisect

n, x = map(int, input().split())
arr = list(map(int, input().split()))

arr.sort()
sum_arr = list(accumulate(arr))

idx = bisect(arr, x)
print(idx)
