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

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

cnt = 0

tot = A[0]

while cnt<N and tot<=x:

    cnt += 1

    if cnt<N:

        tot += A[cnt]

if cnt==N and tot<x:

    cnt -= 1

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

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

if x>=2*sum(A):

    print((0))

else:

    ind = N

    for i in range(N):

        x -= A[i]

        if x<0:

            ind = i

            break

    if ind==N and x>0:

        A = sorted(A,reverse=True)

        for i in range(N):

            x -= A[i]

            if x<0:

                ind -= 1

                break

    print(ind)
N, x = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
cnt = 0
tot = A[0]
while cnt < N and tot <= x:
    cnt += 1
    if cnt < N:
        tot += A[cnt]
if cnt == N and tot < x:
    cnt -= 1
print(cnt)

N, x = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
if x >= 2 * sum(A):
    print((0))
else:
    ind = N
    for i in range(N):
        x -= A[i]
        if x < 0:
            ind = i
            break
    if ind == N and x > 0:
        A = sorted(A, reverse=True)
        for i in range(N):
            x -= A[i]
            if x < 0:
                ind -= 1
                break
    print(ind)

-cnt = 0 -tot = A[0] -while cnt < N and tot <= x: -    cnt += 1 -    if cnt < N: -        tot += A[cnt] -if cnt == N and tot < x: -    cnt -= 1 -print(cnt) +if x >= 2 * sum(A): +    print((0)) +else: +    ind = N +    for i in range(N): +        x -= A[i] +        if x < 0: +            ind = i +            break +    if ind == N and x > 0: +        A = sorted(A, reverse=True) +        for i in range(N): +            x -= A[i] +            if x < 0: +                ind -= 1 +                break +    print(ind)