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

a = sorted(a, reverse = False)

count = 0
if sum(a) < x:
    count = N -1
else:
    for i in a:
        A = x - i
        if A < 0:
            count -=1
            break
        elif A == 0:
            count += 1
            break
        count+=1
if count == -1:
    count = 0
print(count)