
n,x = map(int, input().split())
list = list(map(int, input().split()))

a = 0
i = 0

if list[0] > x:
    print(0)

elif x > sum(list):
    print(n-1)

else:
    while x > 0 and x >= list[i]:
        x -= list[i]
        i += 1
        a += 1
        if i == n:
            break

    print(a)
