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

a.sort()
count = 0

while x > min(a):
    pass
for i in a:
    if x >= i:
        x -= i
        count += 1
    else:
        pass
        
print(count)