import numpy as np



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

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

a = np.sort(a)



cnt = 0

for a_ in a:

    cnt += 1

    if a_ <= x:

        x -= a_

    elif a_ > x:

        x -= a_

        break

print((cnt if x == 0 else cnt - 1))
n, x = list(map(int, input().split()))

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

a = sorted(a)



cnt = 0

for a_ in a:

    cnt += 1

    if a_ <= x:

        x -= a_

    elif a_ > x:

        x -= a_

        break

print((cnt if x == 0 else cnt - 1))
import numpy as np

n, x = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
a = np.sort(a)
cnt = 0
for a_ in a:
    cnt += 1
    if a_ <= x:
        x -= a_
    elif a_ > x:
        x -= a_
        break
print((cnt if x == 0 else cnt - 1))

n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
cnt = 0
for a_ in a:
    cnt += 1
    if a_ <= x:
        x -= a_
    elif a_ > x:
        x -= a_
        break
print((cnt if x == 0 else cnt - 1))

-import numpy as np - -a = np.array(list(map(int, input().split()))) -a = np.sort(a) +a = list(map(int, input().split())) +a = sorted(a)