N, x = map(int,input().split())

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


count = 0

for y in a:
    ama = x -y
    if ama >=0:
        count += 1
        
if sum(a) >= x:
    print(count)
elif count == 0:
    print(0)
else :
    print(count-1)
