Problem:


Score : 200 points

Problem Statement

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 1

3 6
3 4 5

Sample Output 1

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.

Sample Input 2

4 9
3 3 3 3

Sample Output 2

4

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



Sample input:
3 6
3 4 5


Sample output:
2

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
import itertools
l=[0]+l
li = list(itertools.accumulate(l))
a=[li[i] for i in range(len(li)) if li[i]<=x]
print(len(a))

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
count=1
D=0
for i in range(N):
  D=D+L[i]
  if D > X:
    break
  else:
    count=count+1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#128 b むずい
n,x=map(int,input().split())
l=list(map(int,input().split()))
z=0
ans=1
for i in l:
    z+=i
    if z>x:
        break
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
def main():
  n, x, *ls = map(int, open(0).read().split())
  d=0
  cou=1
  for l in ls:
    d += l
    if d <= x:
      cou+=1
    else:
      return(cou)
  return n+1
if __name__ == '__main__':
  print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
if sum(l)<=x:
  print(n+1)
  exit()
i,d=1,0
while(i<n):
  d+=l[i-1]
  if d<=x:
    i+=1
  else:
    break
print(i)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
L = list(map(int, input().split()))
counter = 1
pos = 0
for i in range(n):
  pos += L[i]
  if pos <= x:
    counter += 1
  else:
    break
print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

bound_count = 1
distance = 0
for idx in range(n):
  if distance + l[idx] > x:
    break
  distance = distance + l[idx]
  bound_count += 1
print(bound_count)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
list = list(map(int, input().split()))

cnt = 1
sum = 0

for i in list:
    sum += i
    if sum <= X:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
L=[]; cnt=0
L.append(0)
for i in range(n):
    L.append(L[i]+l[i])
for i in L:
    if i<=x: cnt+=1
    else: break
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def LI():
  return [int(s) for s in input().split()]

N,X = LI()
L_s = LI()

D = [0]*(N+1)

count = 1

for i in range(1,N+1):
  D[i] = D[i-1] + L_s[i-1]
  if D[i] <= X:
  	count += 1
  
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    n,x = map(int, input().split())
    num_list = list(map(int, input().split()))

    sum = 0
    ans = 1

    for i in num_list:
        sum += i
        if sum <= x:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

s = 0
ans = 1

for i in l:
  s += i
  if s <= x:
    ans += 1
  else:
    break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))

import numpy as np

n, x = mi()
l = li()

hane = [0]
for i in range(n):
    d = hane[-1]
    hane.append(int(d+l[i]))

hane = np.array(hane)
ans = np.count_nonzero(hane <= x)

print(ans)

Submission status: Accepted

Solution code:
def calcBoundCount(rangex, lstL):
    d = 0
    for i in range(0, len(lstL)):
        d = d + lstL[i]
        if rangex < d:
            return i + 1
    return len(lstL) + 1
 
N, X = map(int, input().split())
lstL = list(map(int, input().split()))
 
count = calcBoundCount(X, lstL)
print((count if count <= N+1 else N+1))

Submission status: Accepted

Solution code:
n, x = map(int,input().split())
lList = list(map(int,input().split()))

count = 0
calcT = 0
for i in range(n):
  calcT += lList[i]
  if x < calcT:
    break
  else:
    count += 1

print(count+1)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
Len=[int(i) for i in input().split()]

ans=n+1
test=0
for i in range(n):
  test+=Len[i]
  if test<=x:
    continue
  else:
    ans=i+1
    break
    
print(ans)

Submission status: Accepted

Solution code:
import sys

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

D = 0

for i in range(0,N):
    D += L[i]
    if D > X :
        print(i+1)
        sys.exit()

print(N+1)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
llis=list(map(int,input().split()))
counter=0
ds=0
if ds<=x:
	counter+=1 
for i in range(0,n):
	d=ds+llis[i]
	if d<=x:
		counter+=1
	ds=d
print(counter)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = [int(i) for i in input().split()]
L.insert(0, 0)

d = 0
count = 0
for l in L:
  if d + l <= X:
    d += l
    count += 1
  else:
    break
    
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, x = na()
l = na()
d = [0 for _ in range(n + 1)]

d[0] = 0
res = 1
for i in range(1, n + 1):
    d[i] = d[i - 1] + l[i - 1]
    if d[i] <= x:
        res += 1

print(res)

Submission status: Accepted

Solution code:
def main():
    N,X = map(int,input().split())
    L = list(map(int,input().split()))
    jump = [0]*(N**4)
    jump[0] = 1
    d = 0
    for i in range(N):
        d += L[i]
        jump[d] = 1
    
    print(sum(jump[:X+1]))
    


if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
N, X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
ans = 0
prev = 0
for i in range(N + 1):
    D = 0 if i == 0 else prev + L[i - 1]
    if D <= X:
        ans += 1
    prev = D
print(ans)

Submission status: Accepted

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

d = [0] * (n + 1)

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

print(sum(1 for i in d if i <= x))

Submission status: Accepted

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


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = [int(i) for i in input().split()]

d = [0]
for i in range(len(l)):
   d.append(d[-1]+l[i])

print(len([i for i in d if i <= x]))

Submission status: Accepted

Solution code:
n, x = map(int, input().split(' '))
l = list(int(s) for s in input().split(' '))

bounce = [0]
d = 0

for i in range(n):
    d += 0 + l[i]
    bounce.append(d)

count = 0
for i in bounce:
    if i <= x:
        count += 1

print(count)

Submission status: Accepted

Solution code:
import sys
 
N, X = map(int, (input().split()))
L = list(map(int, input().split()))
point = 0
count = 1
 
for x in range(0, N):
    point+=L[x]
    if(point<=X):
        count+=1
    if(point>=X):
        print(count)
        sys.exit()
 
print(count)

Submission status: Accepted

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

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


print(sum(i <= x for i in d))

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = map(int, input().split())
D = 0
ans = 1

for l in L:
    D = D + l

    if D > X:
        break

    ans += 1

print(ans)

Submission status: Accepted

Solution code:
# import itertools
# import math


def solve(N, X, L):
    ans = 1
    now = 0
    for ll in L:
        now += ll
        if now <= X:
            ans += 1
    return ans


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

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(N, X, L))

Submission status: Accepted

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

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

print(len([i for i in d if i <= x]))

Submission status: Accepted

Solution code:
#python3
n,x=map(int, input().split())
l=[int(i) for i in input().split()]
d=0
c=1
for i in range(n):
  d=d+l[i]
  if d<=x:
    c+=1
print(c)

Submission status: Accepted

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

a = 0
for i in range(n):
    a = a + l[i]
    #print(a)
    if x == a:
        print(i+1+1)
        break
    elif x < a:
        print(i+1)
        break
    else:
        continue
else:
    print(n+1)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

# import numpy as np
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, X, *L = map(int, read().split())

Lcum = itertools.accumulate(L)

answer = sum(i <= X for i in Lcum)
print(answer + 1)

Submission status: Accepted

Solution code:
import itertools

N, X = [int(_) for _ in input().split()]
L = [int(_) for _ in input().split()]

bounce_positions = list(itertools.accumulate([0]+L))
ans = sum(x <= X for x in bounce_positions)
print(ans)

Submission status: Accepted

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

    res = 0
    cnt = 1
    for i in l:
        res += i
        if res <= x:
            cnt += 1
        else:
            print(cnt)
            return
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, X = [int(_) for _ in input().split()]
L = [int(_) for _ in input().split()]

cnt = 1
dn = 0
for n in range(0, N):
    dn += L[n]
    if dn <= X:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
dis = 0
ans = 1
for i in L:
    dis += i
    if dis > X:
        break
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, x = map(int, input().split())
    l = tuple(map(int, input().split()))

    d = 0
    for i in range(1, n+1):
        d += l[i-1]
        if d > x:
            print(i)
            quit()
    else:
        print(n+1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,x=map(int,input().split())

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

Submission status: Accepted

Solution code:
def main():
    N, X = map(int, input().split(" "))
    L = list(map(int, input().split(" ")))
    d = 0
    result = 1
    for i in range(0, N):
        d += L[i]
        if d <= X:
            result += 1
        else:
            break
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
Ls = [int(i) for i in input().split()]

Ds = [0]
for i, l in enumerate(Ls):
    Ds.append(Ds[i] + l)

print(sum([d <= X for d in Ds]))

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
Ls = [int(i) for i in input().split()]

Ds = [0]
for i, l in enumerate(Ls):
    Ds.append(Ds[i] + l)

ans = 0
for d in Ds:
    if d <= X:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

n, x = [int(_) for _ in input().split()]
l = np.cumsum(np.array([int(_) for _ in input().split()]))
print(sum([i <= x for i in l])+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l_list = list(map(int, input().split()))
where = 0
count = 1
for l in l_list:
    where += l
    if where > x:
        print(count)
        exit()
    count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
d = [sum(L[:i]) for i in range(N+1)]
print(sum(i <= X for i in d))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,X = list(map(int,input().split(" ")))
listA = [0]
count = 0
F = 0
R = list(map(int,input().split()))
for i in range(N):
    F += R[count] 
    if X < F:
        break
    else:
        listA.append(F)
        count += 1
print(len(listA))

Submission status: Accepted

Solution code:
N, X, *L = map(int, open(0).read().split())

c = 1
s = 0
for l in L:
    s += l 
    if s <= X:
        c += 1
    else:
        break

print(c)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]
ans=1
for i in range(2,n+2):
    z=d[i-2]+l[i-2]
    d.append(z)
    if z<=x:
        ans+=1
    else:
        break
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
pref_sum = [0]*(N+1)
ans = 0

for i in range(N):
    pref_sum[i+1] = L[i]+pref_sum[i]



for s in pref_sum:
    if s <= X:
        ans += 1     
print(ans)

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

count = 1
dis = 0

for i in range(n):
  dis += l[i]
  count += 1
  if dis == x:
    print(count)
    break
  elif dis > x:
    print(count-1)
  elif count == (n+1):
    print(count)
  else:
    continue
  break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
    d += l[i]
  i += 1
print(i)

Submission status: Accepted

Solution code:
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
 
    ans = 1
    D = 0
    for i in range(N):
      D = D + L[i]
      if D <= X:
        ans+=1
        
    return ans
    
if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
num = list(map(int,input().split()))
bound=0
cnt=1
for i in range(a):
	bound+=num[i]
	if(bound<=b):
		cnt+=1
print(cnt)

Submission status: Accepted

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

D = [0]
for l in L:
  d = D[-1] + l
  if d <= X:
    D.append(d)
  else:
    break

print(len(D))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N, X =map(int, input().split())
L = list(map(int, input().split()))
tmp=0
cnt=0

for i in range(N+1):
	if tmp <= X:
		cnt+=1
	else:
		break
	if i < N:
		tmp+=L[i]
		
print(cnt)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
l.insert(0, 0)
cnt = 0
d = []

for i in range(n+1):

    d.append(sum(l[:i+1]))

for i in range(n+1):

    if d[i]<=x:
        cnt += 1


print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
Ls = list(map(int, input().split()))

Di = list()
for i in range(n+1):
    if i == 0:
        Di.append(0)
    else:
        Di.append(Di[-1] + Ls[i-1])
    
cnt = 0
for i in range(len(Di)):
    if Di[i] <= x:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate


N, X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
L_cumsum = accumulate(L)
ans = len([l for l in L_cumsum if l <= X]) + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if sum(l)<=x:
  print(n+1)
  exit()

i=0
d=0
while d<=x:
    d+=l[i]
    i+=1
print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N, X = map(int, input().split())
L = np.array(list(map(int, input().split())))
L = np.append(0, L)
print(np.count_nonzero(L.cumsum() <= X))

Submission status: Accepted

Solution code:
N, *L,  = [list(map(int, s.split())) for s in open(0)]
L = L[0]
idx = 0
cnt = 1

for l in L:
    idx += l
    if idx <= N[1]:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,x = LI()
l = LI()

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

Submission status: Accepted

Solution code:
from itertools import accumulate
from operator import add

n,x=map(int,input().split())
lst=[0]
lst.extend([int(i) for i in input().split()])

lst2=list(accumulate(lst,add))
print(len([i for i in lst2 if i<=x]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n,x=map(int,input().split())
A=list(map(int,input().split()))

for i in range(n):
    if x-A[i]<0:
        print(i+1)
        exit()
    else:
        x-=A[i]

print(n+1)

Submission status: Accepted

Solution code:
N, X = list(map(int, input().split()))
bounds = list(map(int, input().split()))

zahyos = [0]
for i, bound in enumerate(bounds):
    zahyo = zahyos[i] + bound
    zahyos.append(zahyo)
    
cnt = 0
for num in zahyos:
    if num <= X:
        cnt += 1
    
print(cnt)

Submission status: Accepted

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

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

if x >= sum(l):
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

dp = [-1]*(N+2)
dp[1] = 0

ans = 1
for i in range(2, N+2):
    dp[i] = dp[i-1]+L[i-2]
    if dp[i] <= X:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = 0
ans_list = [0]
for i in L :
  ans += i
  if ans <= X :
    ans_list.append(ans)
  else :
    break
print(len(ans_list))

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
A=list(map(int,input().split()))
D=0
cnt=1
if sum(A)<= X:
  print(N+1)
  exit()
else:
  for i in range(X+1):
    D+=A[i]
    if D <= X:
      cnt+=1
    else:
      print(cnt)
      exit()

Submission status: Accepted

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

cnt = 1
sum_L = 0
for l in L:
    sum_L += l
    if sum_L <= X:
        cnt += 1
    else:
        break

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N,X = map(int,input().split())
sumarr = np.cumsum(list(map(int,input().split())))
print(len(sumarr[sumarr<=X])+1)

Submission status: Accepted

Solution code:
import numpy as np
N,X = map(int,input().split())
arr = list(map(int,input().split()))
sumarr = np.cumsum(arr)
print(len(sumarr[sumarr<=X])+1)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
n = list(map(int, input().split()))
bound=[0]
for i in range(len(n)):
  bound.append(n[i])
  bound[i+1]+=bound[i]
#print(bound)
print(len([i for i in bound if i <=b ]))

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
ans = 1
p = 0
for i in l:
    p += i
    if p <= x:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
cnt = 0

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

Submission status: Accepted

Solution code:
A,D = map(int,input().split())
X = list(map(int,input().split()))
C = [0]
q = 0
for i in range(A):
  if i == 0:
    p = X[0]
    C.append(p)
  else:
    p = p + X[i]
    C.append(p)
for i in C:
  if D >= i:
    q += 1

print(q)

Submission status: Accepted

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

Submission status: Accepted

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

wa = 0
cnt = 1
for i in range(N):
    wa += L[i]
    if wa <= X:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
from itertools import accumulate

N, X = map(int, input().split())
A = [int(x) for x in input().split()]

B = [0] + [x for x in accumulate(A)]

if B[N] <= X:
    ans = N + 1
else:
    ans = 0
    for i in range(N):
        if B[i] > X:
            break
        ans += 1
print(ans)

Submission status: Accepted

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

ans = 1
d = 0

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

print(ans)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
dis = 0
ans = 0
if sum(l) <= x:
    print(len(l) + 1)
else:
    while (dis <= x):
        dis += l[ans]
        ans += 1
    print(ans)

Submission status: Accepted

Solution code:
from itertools import accumulate
N, X = map(int, input().split())
L = list(map(int, input().split()))
print(sum(map(lambda x:x<=X, accumulate([0]+L))))

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L_list = list(map(int,input().split()))

ans = 1
D = 0

for i in L_list:
    D += i
    if D <= X:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L_list = list(map(int,input().split()))

ans = 0
D_list = [0]

for i in range(1,N+1):
    D = D_list[i-1]+L_list[i-1]
    D_list.append(D)

for k in D_list:
    if k <= X:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n, x = ril()
ls = ril()
s = 0
count = 0
for l in ls:
    s += l
    if s <= x:
        count += 1
    else:
        break
print(count + 1)