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

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

List.sort()

ans=0

if sum(List)==x:

    print(n)

    exit()

else:

    for i in range(len(List)-1):

        if x>=List[i]:

            ans+=1

            x-=List[i]

        else:

            break

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

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

a.sort()

cnt=0

if sum(a)==x:

    print(n)

    exit()

else:

    for i in range(n-1):

        if a[i]<=x:

            x-=a[i]

            cnt+=1

print(cnt)
n, x = list(map(int, input().split()))
List = list(map(int, input().split()))
List.sort()
ans = 0
if sum(List) == x:
    print(n)
    exit()
else:
    for i in range(len(List) - 1):
        if x >= List[i]:
            ans += 1
            x -= List[i]
        else:
            break
print(ans)

n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
cnt = 0
if sum(a) == x:
    print(n)
    exit()
else:
    for i in range(n - 1):
        if a[i] <= x:
            x -= a[i]
            cnt += 1
print(cnt)

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