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

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

cnt=0

for i in range(n):

    if x>=a[i]:

        cnt+=1

        x-=a[i]

    else:

        break

    if i==n-1 and x>0:

        cnt-=1

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

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

if a[0]>x:

    print((0))

    exit()

cnt=1

for i in range(1,n):

    a[i]+=a[i-1]

    if a[i]>x:

        break

    cnt+=1

if cnt==n and a[-1]!=x:

    cnt-=1

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

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

-cnt = 0 -for i in range(n): -    if x >= a[i]: -        cnt += 1 -        x -= a[i] -    else: +if a[0] > x: +    print((0)) +    exit() +cnt = 1 +for i in range(1, n): +    a[i] += a[i - 1] +    if a[i] > x: -    if i == n - 1 and x > 0: -        cnt -= 1 +    cnt += 1 +if cnt == n and a[-1] != x: +    cnt -= 1