import numpy as np

N, x = list(map(int, input().split()))

a = np.array(list(map(int, input().split())))



cs = np.sort(a).cumsum()



if cs[-1]<x:

    print((N-1))

elif cs[-1]==x:

    print(N)

else:

    print((np.where(cs<=x)[0].shape[0]))
from bisect import bisect_right

from itertools import accumulate



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

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



arr.sort()

arr = list(accumulate(arr))





happy = bisect_right(arr, x)



if happy == n:

    if arr[-1] != x:

        happy -= 1



print(happy)
import numpy as np

N, x = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
cs = np.sort(a).cumsum()
if cs[-1] < x:
    print((N - 1))
elif cs[-1] == x:
    print(N)
else:
    print((np.where(cs <= x)[0].shape[0]))

from bisect import bisect_right
from itertools import accumulate

n, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
arr = list(accumulate(arr))
happy = bisect_right(arr, x)
if happy == n:
    if arr[-1] != x:
        happy -= 1
print(happy)

-import numpy as np +from bisect import bisect_right +from itertools import accumulate -N, x = list(map(int, input().split())) -a = np.array(list(map(int, input().split()))) -cs = np.sort(a).cumsum() -if cs[-1] < x: -    print((N - 1)) -elif cs[-1] == x: -    print(N) -else: -    print((np.where(cs <= x)[0].shape[0])) +n, x = list(map(int, input().split())) +arr = list(map(int, input().split())) +arr.sort() +arr = list(accumulate(arr)) +happy = bisect_right(arr, x) +if happy == n: +    if arr[-1] != x: +        happy -= 1 +print(happy)