n,x = map(int,input().split())
cou = 0
lis = list(map(int,input().split()))
for i in range(n):
  if i != n-1:
    if x >= lis[i]:
      x -= lis[i]:
        cou += 1
  else:
    if x == lis[i]:
      cou += 1
print(cou)