N, x = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
children = [0] * N
a.sort()
kashi = 0
n = N
if a[0] > x:
    print(0)
elif sum(a) == x:
    print(N)
else:
    while kashi < x:
        for i in range(0,n):
            kashi += a[i]
            children[i] += 1
            if kashi > x:
                kashi -= a[i]
                children[i] -= 1
                break
#        print(kashi)
        n -= 1
        if n < 1:
            break
#    print(children)
    print(N - children.count(0))