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

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

a.sort()

ans = 0

if x > sum(a):

        print((n-1))

else:

        for _a in a:

                x -= _a

                if x < 0:

                        print(ans)

                        exit()

                else:

                        ans += 1

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

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



A.sort()

ans = 0

for a in A:

    x -= a

    if x < 0:

        break

    else:

        ans += 1

if 0 < x:

    ans -= 1



print((max(ans, 0)))

n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
ans = 0
if x > sum(a):
    print((n - 1))
else:
    for _a in a:
        x -= _a
        if x < 0:
            print(ans)
            exit()
        else:
            ans += 1
    print(ans)

n, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
ans = 0
for a in A:
    x -= a
    if x < 0:
        break
    else:
        ans += 1
if 0 < x:
    ans -= 1
print((max(ans, 0)))

-a = list(map(int, input().split())) -a.sort() +A = list(map(int, input().split())) +A.sort() -if x > sum(a): -    print((n - 1)) -else: -    for _a in a: -        x -= _a -        if x < 0: -            print(ans) -            exit() -        else: -            ans += 1 -    print(ans) +for a in A: +    x -= a +    if x < 0: +        break +    else: +        ans += 1 +if 0 < x: +    ans -= 1 +print((max(ans, 0)))