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

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

l.sort()



i = 0

ans = 0

while x > 0 and i<= n-1:

  if x >= l[i]:

    x -= l[i]

    if i == n-1:

      if x == 0:

        ans += 1

        break

      else:

        break

    else:

      i += 1

      ans += 1

  else:

    x = 0

    break

print(ans)

  

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

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

A.sort()

ans = 0

for i, a in enumerate(A):

    if i != n-1:

        if x >= a:

            ans += 1

            x -= a

        else:

            break

    else:

        if x == a:

            ans += 1

        else:

            break

print(ans)

n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()
i = 0
ans = 0
while x > 0 and i <= n - 1:
    if x >= l[i]:
        x -= l[i]
        if i == n - 1:
            if x == 0:
                ans += 1
                break
            else:
                break
        else:
            i += 1
            ans += 1
    else:
        x = 0
        break
print(ans)

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

-l = list(map(int, input().split())) -l.sort() -i = 0 +A = list(map(int, input().split())) +A.sort() -while x > 0 and i <= n - 1: -    if x >= l[i]: -        x -= l[i] -        if i == n - 1: -            if x == 0: -                ans += 1 -                break -            else: -                break +for i, a in enumerate(A): +    if i != n - 1: +        if x >= a: +            ans += 1 +            x -= a -            i += 1 +            break +    else: +        if x == a: -    else: -        x = 0 -        break +        else: +            break