N, x = map(int, input().split())
a = list(map(int, input().split()))
candies = 0
over = 0
for i in a:
    candies += i
    if x < i:
        over += 1

if candies == x:  # 全員満足
    print(N)
    exit()
elif over == len(a):  # 全員不満足
    print(0)
    exit()
elif candies < x:
    print(N - 1)
    exit()
else:
    print(N - over)
    exit()