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()))
y = 0
ans = 0
for i in range(n):
  if y<=x:
    ans+=1
  y+=L[i]

if y<=x:
  ans+=1
print(ans)

Submission status: Accepted

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

cnt = 1
now = 0
flg = True
while l:
    now += l.pop(0)
    if now <= x:
        cnt += 1
    else:
      break
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, x = map(int, input().split())
    inlis = list(map(int, input().split()))
    ans = 1
    tmp = 0

    for i in range(n):
        tmp += inlis[i]
        if tmp <= x:
            ans += 1
        else:
            break
    print(ans)

    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, x, *l = map(int, open(0).read().split())
a = n+1
i=sum(l)
while a > 1 and i>x:
    a -= 1
    i-=l[a-1]
print(a)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
tmp=0
ans=1
for i in range(n):
    tmp+=l[i]
    if tmp<=x:
        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()))
d = [0] + list(accumulate(l))
print(len([1 for e in d if e <= x]))

Submission status: Accepted

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

D = 0
num = 1

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

Submission status: Accepted

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

L = list(map(int, input().split()))
D = 0
count = 1

for i in L:
    D += i
    if D <= X:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d = [0] * (n+1)
ans = 1
for i in range(1, n+1):
    d[i] = d[i-1] + l[i-1]
    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()))

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

ans = 0
for j in range(n+1):
    if bound[j] <= x:
        ans += 1
print(ans)

Submission status: Accepted

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

for e in l:
    sum += e
    if sum > x:
        break
    cnt += 1

print(cnt)

Submission status: Accepted

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

m = 0
ans = 1
for l in L:
    m += l
    if m > X:
        print(ans)
        exit()
    else:
        ans += 1

print(ans)

Submission status: Accepted

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

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(N):
    d += L[i]
    if d <= X:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

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

ans = 1
num = 0

for i in range(l):
	num += S[i]
	if num <= X:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:
import itertools
N,X=map(int,input().split())
L=[int(x) for x in input().split()]
ans=sum(x<=X for x in itertools.accumulate([0]+L))
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]
ans=0
for d in D:
    if d<=X:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc130/tasks/abc130_b"

def main():
    n,x = list(map(int, input().split()))
    lis = list(map(int, input().split()))
    lis.insert(0, 0)
    count = 0
    pos = 0
    for l in lis:
        pos += l
        count += 1
        if pos > x:
            print(count-1)
            exit()
    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

N, X = map(int, sys.stdin.readline().split())
L = list(map(int, sys.stdin.readline().split()))

ans = 0
for i, l in enumerate(L):
    ans += l
    if ans > X:
        print(i+1)
        break
else:
    print(N+1)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
L = list(map(int,input().split()))
sum = 0
count = 1
for j in range(n):
  sum += L[j]
  if sum <= x:
    count += 1
  else:
    pass
print(count)

Submission status: Accepted

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

list1=list(map(int,input().split()))
a=0
ans=1

for i in range(N):
    a=a+list1[i]
    if a<=X:
        ans+=1
        
print(ans)

Submission status: Accepted

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

arr=list(map(int,input().split()))
a=0
ans=1

for i in range(N):
    a=a+arr[i]
    if a<=X:
        ans+=1
        
print(ans)

Submission status: Accepted

Solution code:
# 130 B

n, x = map(int, input().split())
l = list(map(int, input().split()))
sum = 1
co = 0

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

print(sum)

Submission status: Accepted

Solution code:
def cumsum(xs):
    result = [0,xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result
a,b=map(int,input().split())
c=list(map(int,input().split()))
n=cumsum(c)
ans=[]
for i in range(len(n)):
    if n[i]<=b:
        ans.append(n[i])
print(len(ans))

Submission status: Accepted

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

mj = 0
cnt = 1
for i in range(N):
    mj += LL[i]
    if mj <= X:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l_l = map(int, input().split())
z = 0
cnt = 1
for i in l_l:
    z += i
    if z <= x:
        cnt += 1
    else:
        break
print(cnt)

Submission status: Accepted

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

save = 1
for i in range(1,n+2):
    if(i==1):
        d = 0
        continue
    d = d + l[i-2]
    if(d > x):
        break
    save = i
    
print(save)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

l = []
cnt = 0
l.append(int(0))
for i in range(N):
  l.append(l[i]+L[i])
  if l[i] <= X:
    cnt += 1
if l[-1] <= X:
  cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arr1 = input().split()
n,x = int(arr1[0]),int(arr1[1])

arr2 = input().split()

d = 0
count = 1
for i in range(1, n + 1):
  d += int(arr2[i-1])
  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()))
 
D = 0
a = 1
for i in range(N):
    D = D + L[i]
    if D <= X:
        a += 1
    else:
        break
print(a)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, val= list(map(int,input().split()))
list = list(map(int,input().split()))
d=0
l=[]
for i in list:
  d=d+i
  l.append(d)
count=0
for num in l:
  if num<=val:
    count=count+1
print(count+1)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, X, *L = map(int, read().split())
    
    ans = 1
    d = 0
    for l in L:
        d += l
        if d <= X:
            ans += 1
        else:
            break
    
    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
n, x = map(int, input().split())
#s = input()
#s,t = input().split()
#
readline = sys.stdin.readline
l = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

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

Submission status: Accepted

Solution code:
y = [int(z) for z in input().split()]
l = [int(z) for z in input().split()]
d = [0]*(y[0]+1)
c = 1
for i in range(1,y[0]+1):
      d[i] = d[i-1]+l[i-1]
      if (d[i]<=y[1]):
            c+=1
print(c)

Submission status: Accepted

Solution code:
n ,x = map(int,input().split())
l = [int(k) for k in input().split()]
d = 0
cnt = 1
for i in range(n):
  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 = 0
for i in range(2, N + 2):
    if D + L[i - 2] > X:
        print(i - 1)
        break
    D = D + L[i - 2]
else:
    print(i)

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(n):
    d=d+l[i]
    if d<=x:
        ans+=1
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
L.append(0)
D,i,cnt = 0,0,0
while(D <= X and cnt <= N):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
n,x,*l=map(int,open(0).read().split())
c,d=1,0
for i in range(n):
    d+=l[i]
    if d>x:
        print(c)
        break
    else:
        c+=1
else:
    print(c)

Submission status: Accepted

Solution code:
x = list(map(int, input().split()))[1]
l = list(map(int, input().split()))
m = [0]
for i in l:
    if i+m[-1] <= x:
        m.append(i+m[-1])
    else:
        break
print(len(m))

Submission status: Accepted

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

Submission status: Accepted

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

import numpy as np

l = np.cumsum(L)

print(len(l[l<=N])+1)

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, X = il()
    L = il()
    now, ret = 0, 1
    for l in L:
        now += l
        if now <= X:
            ret += 1
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import bisect

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

d = [-1]*(n+1)
d[0] = 0
for i in range(1, n+1):
    d[i] = d[i-1] + l[i-1]
res = bisect.bisect_right(sorted(d), x)
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
n, x = map(int, input().split())
L = list(map(int, input().split()))
D = [0]
ans = 1
for i in range(1, n+1):
  d = D[i-1] + L[i-1]
  D.append(d)
  if d <= 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 = 0
A = 0
if D <= X:
    A += 1
for i in L:
    D += i
    if D <= X:
        A += 1
print(A)

Submission status: Accepted

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

H = 0
count = 0
for i in range(n):
  if H > x:
    print(count)
    exit()
  else:
    H += L[i]
    count += 1
  
if H > x:
  print(n)
else:
  print(n+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,X = (int(x) for x in input().split())
L = [int(x) for x in input().split()]
s = 0
i = 0
while (s <= X):
  if i >= N:
    print(N+1)
    quit()
  else:
    s = s + L[i]
    i = i + 1
print(i)

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

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(N):
    D += L[i]
    if D > X:
        break
    ans += 1

print(ans)

Submission status: Accepted

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

ans = 1
p = 0

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

print(ans)

Submission status: Accepted

Solution code:
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
  else:
    break

print(ans)

Submission status: Accepted

Solution code:
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

print(ans)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
l = list(map(int, input().split()))
l.insert(0, 0)
val, count = 0, 0
for i in l:
    val += i
    if val <= X:
        count += 1
    else:
        break
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

CS_L = np.cumsum(L).tolist()
ans = len([l for l in CS_L if l <= x])
print(ans + 1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

import numpy as np
from collections import deque
from collections import Counter
from itertools import accumulate
from itertools import permutations, combinations
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt
### ceil切り上げ，floor切り下げ

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


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]*(n+1)
ans = 1

for i in range(1,n+1):
    d[i] = d[i-1]+l[i-1]
    if x < d[i]:
        break
    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):
    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()))

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

Submission status: Accepted

Solution code:
def main():
    n,x = map(int,input().split())
    l = list(map(int, input().split()))
    dist = 0
    count = 1
    for i in range(n):
        dist += l[i]
        if dist > x:
            break
        count += 1
    print(count)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 0
    D = 0
    bounds = [D]
    for a in A:
        D += a
        bounds.append(D)

    for b in bounds:
        if b <= X:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# k = int(input())
L = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#ab = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
d = 0
count = 1
for l in L:
    if d+l > x:
        break
    else:
        d = d+l
        count += 1

print(count)

Submission status: Accepted

Solution code:
import bisect
N,X = map(int,input().split())
L =list(map(int,input().split()))
cnt = 0
M = [0]
for i in range(N):
    cnt += L[i]
    M.append(cnt)

print(bisect.bisect_right(M,X))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N,X=map(int, input().split())
List=list(map(int, input().split()))
bow=0
cnt=1
for i in range(0,N):
    bow+=List[i]
    if bow>X:
        break
    else:
        cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    lsum = [0 for _ in range(N + 1)]
    for i in range(N):
        lsum[i + 1] = L[i] + lsum[i]

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def main():
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    sum = 0
    for idx, i in enumerate(l):
        sum += i
        if sum > x:
            print(idx + 1)
            break
    else:
        print(n + 1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,x = map(int, raw_input().split(' '))
ais = map(int, raw_input().split(' '))
count,cur,i = 1,0, 0
res = []
while(i < len(ais)):
	cur += ais[i]
	if cur <= x:
		count+=1
	else:
		break

	i +=1
print count
#print len([e for e in res if e <= x])

Submission status: Accepted

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

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

K = [0]
for i in range(len(L)):
  K.append(K[i] + L[i])
ans = 0
for i in range(len(K)):
  if K[i] <= x:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n,x = map(int, raw_input().split(' '))
ais = map(int, raw_input().split(' '))
count,cur,i = 0,0, 0
res = [cur]
while(i < len(ais)):
	cur += ais[i]
	res.append(cur)
	i +=1

print len([e for e in res if e <= x])

Submission status: Accepted

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

for i in range(N):
    M = M + L[i]
    if M > X:
        print(C)
        exit(0)
    
    C = C + 1

print(C)

Submission status: Accepted

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

d = 0
count = 1
for v in l:
    dv = d + v
    # print(dv)
    
    if dv > x:
        break
    
    count += 1
    d += v

print(count)

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(0,n):
    d=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()))

D = 0
ans = 1

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

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
N,X = (int(x) for x in input().split())
L = list(map(int, input().split()))
d =[0]*(N+1)
count =1
for i in range(N):
    d[i+1] =d[i] +L[i]
    if d[i+1] <= X:
        count +=1
    else:
        break
print(count)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
a = [0] + list(map(int, input().split()))
ans = 0
for i in range(n):
    a[i + 1] += a[i]
for i in range(n + 1):
    if a[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] + [0]*n
c = 1
for i in range(n):
    d[i+1] = d[i] + L[i]
    if d[i+1] <= x:
        c += 1
print(c)

Submission status: Accepted

Solution code:
from bisect import bisect_right
N, X = map(int, input().split())
L = list(map(int, input().split()))
s = [0] * (N+1)
for i in range(N):
	s[i+1] = s[i] + L[i]
pos = bisect_right(s, X)
print(pos)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, x = map(int, input().split())
    l = list(map(int, input().split()))

    ans = 1
    d = 0
    for li in l:
        if d + li <= x:
            ans += 1
            d += li
        else:
            break
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

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

cn=1
ln=0
for i in l:
  ln+=i
  if ln>x:
    break
  cn+=1
  
print(cn)

Submission status: Accepted

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

pos = 0
cnt = 1
for i in range(n):
    pos = pos + l[i]
    if pos <= x:
        cnt += 1
    else:
        break

print(cnt)

Submission status: Accepted

Solution code:
def actual(n, x, L):
    bounce_list = [0]

    for l in L:
        bounce_list.append(bounce_list[-1] + l)

    return [height <= x for height in bounce_list].count(True)

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

print(actual(n, x, L))

Submission status: Accepted

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

count=1

takasa=0
for i in range(N):
    takasa+=S[i]
    if takasa<=X:
        count+=1

print(count)

Submission status: Accepted

Solution code:
import math
def ip():return int(input())
def inp():return map(int,input().split())
def linp():return list(map(int,input().split()))

n,x=inp()
l=linp()
d=0
ans=1
for i in range(1,n+1):
    d=l[i-1]+d
    if d<=x: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 l:
    if D+i<=x:
        ans+=1
        D+=i
    else:
        break
print(ans)

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(n):
  d = 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()))
d = 0
ans = 1
for i in range(n):
  d += l[i]
  if d <= x:
    ans += 1
print(ans)

Submission status: Accepted

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

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

p = [0]

for i in range(1,n+1):
    p.append(p[i-1]+lis[i-1])
    
cnt = 0
for j in p:
    if j <= x:
        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]*(n+1)
o=True
for i in range(n):
    D[i+1]=D[i]+L[i]
for i in range(len(D)):
    if D[i]>x:
        print(i)
        o=False
        break
if o:
    print(n+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for d in range(N):
  D += L[d]
  if D > X:break
  count += 1
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(n):
    D[i + 1] = D[i] + L[i]

from bisect import bisect_left, bisect_right

idx = bisect_right(D, x)
print(len(D[:idx]))

Submission status: Accepted

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

Submission status: Accepted

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

for i in l:
    ll += i
    if x < ll:
        print(ans)
        exit()
    ans += 1
print(ans)

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(n):
    D[i + 1] = D[i] + L[i]

from bisect import bisect_left, bisect_right

idx = bisect_right(D, x)
print(len(D[:idx]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]*(n+1)
ans=0
for i in range(n):
  d[i+1]=d[i]+l[i]
for i in range(n+1):
  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]*(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

print(cnt)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
ln = [0]*(n+1)
for i in range(n):
  ln[i+1] = ln[i] +l[i]
 

for i in range(n+1):
  if ln[i]>x:
    print(i)
    exit()

print(n+1)

Submission status: Accepted

Solution code:
def resolve():
    N, X = map(int, input().split())
    ans = [int(i) for i in input().split()]
    D = 0
    no = N
    for i in range(N):
        D = D + ans[i]
        if D > X:
            no = i
            break
    print(no+1)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

for k in range(n):
        sum += l[k]
        if sum <= x:
            ans+=1
            continue
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
import bisect
N,X=map(int,input().split())
L=list(map(int,input().split()))
for i in range(N-1):
  L[i+1]+=L[i]
print(bisect.bisect_left(L,X+1)+1)