# 27 --- > dbt
# try 1

n, x = map(int, input().split())
a = list(map(int, input().split()))
num = 0
left = 0 

for i in range(len(a)-1):
    if x >= a[i] :
        num += 1
        x -= a[i]
    else:
        left += a[i]

if num == (n-1) and x == a[-1]:
    num += 1
elif num != (n-1) and x >= a[-1]:
    num += 1
    
print(num)