A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \leq i \leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.
How many times will the ball make a bounce where the coordinate is at most X?

-----Constraints-----
 - 1 \leq N \leq 100
 - 1 \leq L_i \leq 100
 - 1 \leq X \leq 10000
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N X
L_1 L_2 ... L_{N-1} L_N

-----Output-----
Print the number of times the ball will make a bounce where the coordinate is at most X.

-----Sample Input-----
3 6
3 4 5

-----Sample Output-----
2

The ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.

Difficulty: introductory

Starter code:

Solutions:
import itertools
import bisect

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

a = list(itertools.accumulate(l, initial=0))
print(bisect.bisect_right(a, x))

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

l_list=[int(i) for i in input().split()]

d=0
count=1
for i in range(n):
    d=d+l_list[i]
    if d<=x:
        count+=1

print(count)


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

l = list(map(int, input().split()))


ans = 0

d = 0

for i in range(n):
    if d <= x:
        ans += 1
    d += l[i]

if d <= x:
    ans += 1

print(ans)

import bisect
from itertools import accumulate
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
Lsum = list(accumulate(L))
ind = bisect.bisect_right(Lsum, X)
print((ind+1))


import bisect
n, x = map(int, input().split())
l = [0] + list(map(int, input().split()))
for i in range(n):
  l[i+1] += l[i]
print(bisect.bisect_left(l, x+1))

N,X=list(map(int,input().split()))
L=list(map(int,input().split()))
x=0
ans=1
for i in range(N):
    x+=L[i]
    if x<=X:
        ans+=1
print(ans)





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

l1 = [0]+l
for i in range(1, len(l)+1):
    l1[i] = l1[i-1]+l[i-1]
cnt = 0

for i in range(0, len(l1)):
    if (l1[i] <= x):
        cnt += 1
print(cnt)


N, M = map(int, input().split())
L = list(map(int, input().split()))
d = 0
ans = 1
for l in L:
  d += l
  if d <=M:
    ans += 1
  else:
    break
print(ans)

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

d = [0]
for i in range(n):
    d.append(d[-1]+l[i])
print(len([i for i in d if i <= x]))

n, x = list(map(int,input().split()))
l = list(map(int,input().split()))
a = [0]
for i in range(n):
    tmp = a[i] + l[i]
    a.append(tmp)
ans = 0
for i in range(n + 1):
    if (a[i] <= x):
        ans = ans + 1

print(ans)


n,x = map(int, input().split())
L = list(map(int, input().split()))
cnt = 1
d = 0
for l in L:
  d += l
  if d <= x:
    cnt += 1
  else:
    break
print(cnt)

from itertools import accumulate
from bisect import *
N, X = list(map(int, input().split()))
L = list(tuple(map(int, input().split())))

acc = sorted(list(accumulate(L)) + [0])

n = bisect_right(acc,X)
print(n)



# AtCoder Beginner Contest 130
# B - Bounding
import bisect

N,X=map(int,input().split())
L=list(map(int,input().split()))

accumu_L=[0]

for i in range (N):
    accumu_L.append(accumu_L[-1]+L[i])

# print(accumu_L)

print(bisect.bisect_right(accumu_L,X))

n,x=map(int,input().split())
l=list(map(int,input().split()))+[10**5]

d,cnt=0,0
while d<=x and cnt<n+1:
  d+=l[cnt]
  cnt+=1

print(cnt)

N,X = list(map(int,input().split()))
li = list(map(int,input().split()))
d = 0
c = 1
for i in range(N):
  d = d + li[i]
  if d <=X:
    c = c + 1
print(c)          


a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
e=0
for i in range(a):
  if d+c[i]<=b:
    d=d+c[i]
    e=e+1
  else:
    break
print(e+1)

n,x=map(int,input().split())
l=list(map(int,input().split()))
ans=1
d=0
for i in range(len(l)):
    d=d+l[i]
    if d<=x:
        ans+=1
print(ans)

n,x = map(int, input().split())
a = [int(num) for num in input().split()]
sum = 0
cont = 1
for i in range(n):
    sum += a[i]
    if sum <= x:
        cont += 1
print(cont)

from collections import defaultdict


def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, x = Input()
    l = Input()
    d = defaultdict(int)
    d[0] = 0
    ans = 0

    for i in range(1, n+1):
        d[i] = d[i-1] + l[i-1]

    for i in d.values():
        if i <= x: ans += 1

    print(ans)

main()

n,x=map(int,input().split())
Y = list(map(int,input().split()))
Z = [0]*n
a = 0
for i in range(n):
  a +=Y[i]
  Z[i]=a
import bisect
print(1+bisect.bisect_left(Z,x+1))

n,x=map(int,input().split())
L=list(map(int,input().split()))
ans = 1
cnt = 0
for l in L:
  cnt += l
  if x >= cnt:
    ans += 1
print(ans)

n, x = map(int, input().split())
l = list(map(int, input().split()))
bound = []
for i in range(n+1):
    if i == 0:
        bound += [0]
    else:
        bound += [bound[i-1] + l[i-1]]
    if bound[i] > x:
        print(len(bound) - 1)
        return
print(len(bound))

N, X = list(map(int, input().split()))
L = list(map(int, input().split()))

current = 0
cnt = 1
for l in L:
    current += l
    if current > X:
        break
    cnt += 1

print(cnt)


# Di = Di-1 + Li-1
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = 0
ct = 1 
for i in range(n):
    ans = ans + L[i]
    if ans > x:
        break
    else:
        ct += 1
print(ct)


N, X = map(int, input().split())
L = list(map(int, input().split()))

s = 0
cnt = 1
for i in range(N):
    if s + L[i] > X:
        break
    s += L[i]
    cnt += 1

print(cnt)

n,x =  map(int,input().split())
l = list(map(int,input().split()))
ans = 0
cnt = 1
for i in l:
  ans += i
  if ans > x:
    break
  cnt += 1
  
print(cnt)

import bisect

N, X = list(map(int, input().split()))
L = list(map(int, input().split()))

D = [0]
for i in range(len(L)):
    D.append(sum(L[:i+1]))
print((bisect.bisect_right(D, X)))


a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 1
d = 0
for i in b:
  d += i
  if d <= a[1]:
    c += 1
print(c)


n,x = map(int, input().split())
a = [int(num) for num in input().split()]
sum = 0
cont = 1
for i in range(n):
    sum += a[i]
    if sum <= x:
        cont += 1
print(cont)

N,X = map(int,input().split())
L = [int(i) for i in input().split()]
D = 0
for i in range(N) :
    D = L[i]+D
 #   print(i,D)
    if D>X :
        print(i+1)
        return

print(N+1)

r=input().split()
N=int(r[0])
X=int(r[1])
d=[int(s) for s in input().split()]
ans=1
le=0
for i in range(N):
    le+=d[i]
    if le>X:
        print(ans)
        break
    elif i==N-1:
        print(N+1)
    else:
        ans+=1

n, x = map(int, input().split())
l = [int(s) for s in input().split()]

pos = 0
count = 1
for i in range(n):
    pos += l[i]
    if pos > x:
        break
    count += 1
print(count)

N, X  = map(int, input().split())
L = list(map(int, input().split()))
count = 1
distance = 0
for l in L:
  distance += l
  if distance <= X:
    count += 1
  else:
    break
print(count)

n, x = map(int, input().split())
l = list(map(int, input().split()))
xlist = [0]
num = 0
for i in l:
    num += i
    xlist.append(num)
cnt = 0
for j in xlist:
    if j <= x:
        cnt += 1
print(cnt)

n, X = map(int, input().split())
l = list(map(int, input().split()))

sumList = [0]
for i in range(n):
    s = sumList[i]+l[i]
    if s > X:
        break
    sumList.append(s)

print(len(sumList))

N, X = map(int, input().split())
L = list(map(int, input().split()))
S = [0]
for i in range(N):
  S.append(S[i] + L[i])
ans = 0
for j in range(N+1):
  if S[j] <= X:
    ans += 1
print(ans)

N,X=map(int,input().split())
L=list(map(int,input().split()))
ans=0

for i in range(1,N+1):
  if ans>=X:
    if ans==X:
      print(i)
      break
    else:
      print(i-1)
      break
  ans+=L[i-1]
else:
  print(N+1)

import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, x = LI()
l = LI()
cnt = 1
d = 0
for i in range(n):
    # print(f'{(d, l[i])=}')
    if d + l[i] <= x:
        cnt += 1
        d += l[i]
    else:
        break
print(cnt)


N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 0
for i in range(N+1):
  if D <= X:
    count += 1
  if i != N:
    D = D + L[i]
print(count)

n, x = map(int, input().split())
l = list(map(int, input().split()))
L = [0] + l

a = 0
count = 1
for i in l:
    a += i
    if a <= x:
        count += 1
print(count)

n,x=map(int, input().split())
l=list(map(int, input().split()))
d=0
count=0
for i in range(n):
  d+=l[i]
  if d>x:
    print(i+1)
    break
  if i==n-1 and d<=x:
    print(n+1)

n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
i = 0
while d <= x and i <= n:
    if i == n:
        i += 1
    else:
        d += l[i]
        i += 1
print(i)

n,x=map(int,input().split())
ans=1
p=0
l=[int(x) for x in input().split()]
for i in range(n):
    p+=l[i]
    if p > x:
        break
    else:
        ans+=1

print(ans)

x, y = list(map(int, input().split()))
num_list = list(map(int, input().split()))

i = 1
distance = 0
for _ in num_list:
    distance += _
    if distance > y:
        break
    i += 1

print(i)


n, x = map(int, input().split())
l = list(map(int, input().split()))
ans = 1
p = 0

for i in range(n):
    p += l[i]
    if p <= x:
        ans += 1
    else:
        break

print(ans)

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

ans = 0
bound = 0
for i in l:
    bound += i
    ans += 1
    if bound > x:
        break
else:
    ans = n + 1

print(ans)


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

d = [0]*(n+1)
cnt = 0 
for i in range(n):
    d[i+1] += d[i]+L[i]

for i in range(n+1):
    if d[i] <= x:
        cnt += 1

print(cnt)


n,x = map(int,input().split())
a = list(map(int,input().split()))
c = 1
b = 0
for i in a:
    b = i+b
    if b <= x:
        c+=1
print(c)

n,x = map(int,input().split())
a = list(map(int,input().split()))
a.append(0)
count = 0
b = 0
for i in range(n+1):
    if b > x:
        break
    count+=1
    b+= a[i]
print(count)

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print((k.join(list(map(str, lst)))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N, X = MI()
    L = LI()

    A = [0] * (N+1)
    for i in range(1, N+1):
        A[i] = L[i-1] + A[i-1]
    ans = 0
    for a in A:
        if a > X:
            break
        ans += 1
    print(ans)

def __starting_point():
    solve()


__starting_point()

n,x=map(int,input().split())
l=list(map(int,input().split()))
list_d=[0]
ans=0
for i in range(1,n+1):
    list_d.append(list_d[i-1]+l[i-1])
for i in list_d:
    if i<=x:
        ans+=1
print(ans)

N, X = map(int, input().split())
L = list(map(int, input().split()))

bound = 1
d = 0
for i in L:
    d += i
    if d <= X:
        bound += 1
print(bound)

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

ans = 1
t = 0
for i in l:
  t += i
  if t <= x: ans += 1
  if t >= x: break
print(ans)

n, x = list(map(int, input().split()))
l = [int(i) for i in input().split()]
p = 0
for i in range(n):
    p += l[i]
    if p > x:
        print((i + 1))
        break
else:
    print((n + 1))


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

cnt = 0
pos = 0
for itr, l in enumerate(L):
  pos += l
  if pos > x:
    print(itr + 1)
    return

print(n + 1)

N,X=list(map(int,input().split()))
L=list(map(int,input().split()))
S=[0]
sum_L=0
for i in range(N):
  sum_L+=L[i]
  S.append(sum_L)
counter=0
for i in range(N+1):
  if S[i]<=X:
    counter+=1
print(counter)


n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]
count=0
for i in range(n):
    d.append(d[i]+l[i])
for c in d:
    if c<=x:
        count+=1
print(count)

N,X = list(map(int,input().split()))
Li = list(map(int,input().split()))

Di = 0
count = 1
for i in Li:
    Di = Di + i
    if Di <= X:
        count += 1
    else:
        break
print(count)



n, x = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
count = 1
for i in range(n):
  ans += l[i]
  if ans <= x:
    count += 1
print(count)

N,X = map(int,input().split())
L = list(map(int,input().split()))
kyori = 0

for i in range(N):
    kyori += L[i]
    if kyori > X:
        print(i+1)
        return

print(N+1)

N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
List = [0]*(N+1)
for i in range(1,N+1):
    List[i] = List[i-1] + L[i-1]
import bisect  
# A = [i for i in List if i <=X]
# print(len(A))
print((bisect.bisect_left(List,X+1)))


n, x = map(int, input().split())
a = list(map(int, input().split()))
s = 0
t = 1
for i in range(n):
  s = s + a[i]
  if s <= x:
    t += 1
print(t)

n,x=map(int,input().split())
L=list(map(int,input().split()))
ans=0
ct=1
for i in range(n):
  ans=ans+L[i]
  if ans>x:
    break
  else:
    ct+=1
print(ct)

n,x = map(int,input().split())
l = list(map(int,input().split()))
cnt = 0
for i in range(n+1):
    #print(sum(l[:i]))
    if sum(l[:i])<=x:
        cnt += 1
print(cnt)

# nは跳ねる回数　d1 = 1 dn+1 = dn + ln

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

d = 0
count = 1

for y in range(n):
  d = d + l[y]
  if d <= x:
    count += 1
  else:
    break
    
print(count)


n, x = (int(i) for i in input().split())
list_l = [int(j) for j in input().split()]
tmp = 0
count = 0
for i in range(0, n + 1):
    if i == 0:
        pass
    else:
        tmp += list_l[i - 1]
        if tmp > x:
            break
    count += 1
print(count)

n, x = map(int, input().split())
llist = list(map(int, input().split()))
dlist = [0]
d = 0
for i in llist:
    d += i
    dlist.append(d)
print(sum([i<=x for i in dlist]))

n,x = map(int,input().split())
l = list(map(int,input().split()))
dist = [0]*(n+1)
for i in range(1,n+1):
    dist[i] = dist[i-1] + l[i-1]
    
cnt = 0
for i in range(n+1):
    if dist[i]<= x:
        cnt += 1
print(cnt) 

N,X = map(int,input().split())
L_List = list(map(int,input().split()))
ans = 0
ct = 1
for i in range(N):
    ans += L_List[i]
    if ans <= X:
        ct += 1
    else:
        break
        
print(ct)

N,X = map(int,input().split())
L = [int(i) for i in input().split()]
D = [0]

for i in range(N):
    a = D[i]+L[i]
    if(a <= X):
        D.append(a)
    else:
        break

print(len(D))

n, x = map(int, input().split())
L = list(map(int, input().split()))
val = 0
count = 1

for l in L:
    val += l
    if val <= x:
        count += 1
print(count)

N,X = map(int,input().split())
L = list(map(int,input().split()))
List = [0]*(N+1)
for i in range(1,N+1):
    List[i] = List[i-1] + L[i-1]
A = [i for i in List if i <=X]
print(len(A))

n, x = map(int, input().split())
l = list(map(int, input().split()))
ball = 0
c = 1
for i in range(n):
    ball += l[i]
    if ball <= x:
        c += 1
    else:
        break
print(c)


N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
cnt = 1
total = 0
for i in range(N):
  total += L[i]
  if total <= X:
    cnt += 1
  else:
    break
print(cnt)


N,X=map(int,input().split())
L=list(map(int,input().split()))
l=[0]
s=0
for i in range(N):
   s+=L[i]
   if  s>X:
       break
   l.append(s)
print(len(l))

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

l = list(map(int, input().split()))
ans = 1
p = 0
for i in range(n):
    p += l[i]
    if (p > x):
        break
    else:
        ans += 1

print(ans)


N,X=list(map(int,input().split()))
ls1=list(map(int,input().split()))

x = 0
ii = 1
for i in ls1:
    x = x + i
    if x > X:
        break
    ii += 1
print(ii)


n,x = map(int,input().split())
l = list(map(int,input().split()))
ans = 1
d = [0]*(n+1)
for i in range(1,n+1):
  d[i] = d[i-1]+l[i-1]
  if d[i] <= x:
    ans += 1
print(ans)

n, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
if x == 0:
    print((0))
    return
sum = 0
count = 1
i = 0
while i < n:
    sum += arr[i]
    i += 1
    if sum <= x:
        count += 1
    else:
        print(count)
        return
print(count)


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

num_list = list(map(int,input().split()))
num_sum = 0
count = 1

for i in range(n):
    num_sum += num_list[i]
    if num_sum>x:
        break
    count += 1
print(count)

n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
dist = 0
res = 0
for i, l in enumerate(L, 1):
    dist += l
    if dist > x:
        print(i)
        return
    elif dist == x:
        print((i + 1))
        return
print((n + 1))


N,X = map(int,input().split())
L = list(map(int,input().split()))

D = []
D.append(0)

for i in range(0,N):
  D.append(D[i]+L[i])

cnt = 0
for d in D:
  if d <= X:
    cnt += 1
    
print(cnt)

N, X = map(int, input().split())
L = list(map(int, input().split()))
ans = 1
total = 0
for l in L:
    total += l
    if total > X: break
    ans += 1
print(ans)

a,b=map(int,input().split())
l=list(map(int,input().split()))
c=[0]
count=1
for i in range(a):
    c.append(c[i]+l[i])
    if(c[i+1]<=b):
        count+=1
print(count)

N, X = list(map(int, input().split()))
L = list(map(int, input().split()))

num = 1
s = 0
for i in range(N):
  s += L[i]
  if s > X: break
  num += 1

print(num)




from typing import List


def next_coordinates(d: int, l: int) -> int:
    return d + l


def answer(n: int, x: int, l: List[int]) -> int:
    d = 0
    count = 1
    for i in l:
        d = next_coordinates(d, i)
        if x < d:
            return count
        count += 1

    return count


def main():
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    print(answer(n, x, l))


def __starting_point():
    main()
__starting_point()

import itertools
import bisect

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

dl = [0] + list(itertools.accumulate(ll))

print(bisect.bisect_right(dl, x))


n,x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 1
total = 0

for i in range(n):
    total += a[i]
    if total <= x:
        cnt += 1
print(cnt)


n,x = map(int,input().split())
li = list(map(int,input().split()))
lis = []
sum = 0
for i in range(n):
    sum += li[i]
    lis.append(sum)

cnt = 0
for i in lis:
    if i <= x:
        cnt += 1

print(cnt+1)

n, x = map(int, input().split())
from itertools import accumulate
L =[0] +  list(map(int, input().split()))
acc = list(accumulate(L))
print(sum([1 for i in acc if i <=x]))

A,B=list(map(int,input().split(' ')))
l=list(map(int,input().split(' ')))
ans=0
count=1
for i in l:
    ans+=i
    if ans<=B:
        count+=1
print(count)


N,X=map(int,input().split())
L=list(map(int, input().split()))

D=0

for i in range(N):
	D+=L[i]
	if D>X:
		print(i+1)
		return
		
print(i+2)

N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
cnt = 1
for l in L:
    D = D + l
    if D > X:
        break
    cnt +=1

print(cnt)

n,x = map(int,input().split())
l = list(map(int,input().split()))
wa = 0
d = [0]*(n+3)
d[1]=0
d.pop(0)
wa = 1
for i in range(2,n+2):
  d[i]=d[i-1]+l[i-2]
  if(d[i]>x):
    break
  wa+=1
print(wa)

N, X = [int(i) for i in input().split()]
LS = [int(i) for i in input().split()]

s = 0
cnt = 1

for l in LS:
  s += l
  if s <= X:
    cnt += 1
  else:
    break

print(cnt)


n, x = map(int, input().split())
l = list(map(int, input().split()))
a = 1
d = 0
for i in range(n):
    d += l[i]
    if d <= x:
        a += 1
print(a)