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
for i in range(N):
    b[i] = 0
    for i in range(N):
        b[i] += a[i]
for i in range(N):
    if b[i] <= X:
        c += 1
print(c)