N,X = map(int,input().split())
a = list(map(int,input().split()))
a.sort()

b = []
for i in range(N):
    b.append(i)
c = 0
d = 0
for i in range(N):
    b[i] = d
    for j in range(N):
        d += a[j]
for i in range(N):
    if b[i] <= X:
        c += 1
print(c)