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

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

ans = 0

for i in range(N):

    if x >= a[i]:

        ans += 1

        x -= a[i]

    else:

        break

    if i == N - 1:

        if x != 0:

            ans -= 1

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

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

ans = 0

for i in range(n):

    x -= a[i]

    if x < 0:

        break

    if i == n-1:

        if x > 0:

            break

    ans += 1



print(ans)
N, x = list(map(int, input().split()))
a = sorted(map(int, input().split()))
ans = 0
for i in range(N):
    if x >= a[i]:
        ans += 1
        x -= a[i]
    else:
        break
    if i == N - 1:
        if x != 0:
            ans -= 1
print(ans)

n, x = list(map(int, input().split()))
a = sorted(map(int, input().split()))
ans = 0
for i in range(n):
    x -= a[i]
    if x < 0:
        break
    if i == n - 1:
        if x > 0:
            break
    ans += 1
print(ans)

-N, x = list(map(int, input().split())) +n, x = list(map(int, input().split())) -for i in range(N): -    if x >= a[i]: -        ans += 1 -        x -= a[i] -    else: +for i in range(n): +    x -= a[i] +    if x < 0: -    if i == N - 1: -        if x != 0: -            ans -= 1 +    if i == n - 1: +        if x > 0: +            break +    ans += 1