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

li = 0
li = list(map(int,input().split()))



j = 0
k = 0
while k < N - 1:
    if x > li[k]:
        j += 1
        x = x - li[k]
        k += 1
    else:
        #x = x - li[k]
        k += 1
if x == li[k]:
    j += 1
print(str(j))