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:
a=list(map(int, input().split()))
b=list(map(int, input().split()))
n=a[0]
x=a[1]
c=[0]*(n+1)

for i in range(1,n+1):
    c[i]=c[i-1]+b[i-1]
    
cnt=0

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

Submission status: Accepted

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

l = []
ll = 0
for i in range(len(L)+1):
    for j in range(len(L)+1):
        if j == i:
            break
        ll = ll + L[j]
    l.append(ll)
    ll = 0

cnt = 0
for lll in l:
	if lll <= X:
		cnt = 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(N):
    d+=L[i]
    if d>X:
        break
if d<=X:
    i+=1
print(i+1)

Submission status: Accepted

Solution code:
(N,M) = (int(i) for i in input().split(" "))
A = [int(i) for i in input().split()]
A.append(100000)
for i in range(N):
	A[i+1] += A[i]
	if A[i+1] > M:
		print(i+2)
		break

Submission status: Accepted

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

Submission status: Accepted

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

kaisuu=1
kyori=0

for i in range(len(Ls)):
  kyori=kyori+Ls[i]
  if kyori>X:
    break
  else:
    kaisuu=kaisuu+1

if kaisuu>N+1:
  kaisuu==N+1
    
print(kaisuu)

Submission status: Accepted

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

d = 0
count = 1
for i in input().split(" "):
  d += int(i)
  if (d > x) :
    break
  else :
    count += 1

print(count)

Submission status: Accepted

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

pos = 0
count = 0
i = 0

while i < len(l):
	if pos >= x:
		break
	pos += l[i]
	count += 1
	i += 1

if pos > x:
	print(count)
else:
	print(count+1)

Submission status: Accepted

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

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

indicator = 0
cnt = 0

for i in range(n):

	indicator += l[i]
	if indicator > x:
		break
	else:
		cnt += 1


print(cnt+1)

Submission status: Accepted

Solution code:
n,x = map(int, input().split())
c = list(map(int, input().split()))
c.insert(0,0)
cur = 0
count = 0
for i in c:
    cur += i
    if cur <= x:
        count += 1
    else:
        break
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n, x = input().split()
n = int(n)
x = int(x)
l = input().split()
a = 0

for i in range(n):
  a += int(l[i])
  if a > x:
    print(i+1)
    sys.exit()
    
print(n+1)

Submission status: Accepted

Solution code:
def resolve():
    (N, X) = list(map(int, input().split(" ")))
    Ls = list(map(int, input().split(" ")))
    cur = 0
    cnt = 0
    Ls.insert(0, 0)
    for l in Ls:
        cur += l
        if cur > X:
            print(cnt)
            break
        cnt += 1

    else:
        print(cnt)

    

if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

L = input().split()
pos = 0
ans = 1
for i in range(N):
  pos += int(L[i])
  if(pos <= X):
    ans +=1
  else:
    break
  
print(ans)

Submission status: Accepted

Solution code:
N, X = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
D = [0] * (N+1)
C = 0
for i in range(N):
	D[i+1] = D[i]+L[i]

for i in range(N+1):
	if D[i] <= X:
		C += 1

print(C)

Submission status: Accepted

Solution code:
import sys
inpt = sys.stdin.readline
 
def count(N, X, Ls):
  curr = 0
  if Ls[0]>X:
    return 0
  
  for i in range(N):
    l_im1 = Ls[i]
    curr += l_im1
    if curr > X:
      return i+1
  return N+1
 
N, X = [int(d) for d in inpt().strip().split()]
Ls = [int(d) for d in inpt().strip().split()]
print(count(N, X, Ls))

Submission status: Accepted

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


main()

Submission status: Accepted

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

cnt = 0
ichi = 0
for l in L_list:
    #print(l,'l')
    if ichi > X:
        break
    cnt += 1
    ichi += l

if ichi <= X:
    cnt +=1

print(cnt)

Submission status: Accepted

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

l = [int(i) for i in 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())
a= list(map(int,input().split()))
s= 0
c=1
for v in a:
    s+=v
    if s<=x:
        c+=1

print(c)

Submission status: Accepted

Solution code:
from sys import stdin

N, X = [int(x) for x in stdin.readline().rstrip().split()]
L = [int(x) for x in stdin.readline().rstrip().split()]
Sum = 0
cnt = 1
for i in range(N):
    if Sum + L[i] <= X:
        cnt += 1
        Sum += L[i]
    else:
        break
print(cnt)

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(1, n+1):
    d = d + l[i-1]

    if d <= x:
        count += 1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def main():
    N,X = map(int,input().split())
    L=[int(i) for i in input().split()]
    Ls = 0
    count = 1
    for i in range(N):
        Ls = Ls+L[i]
        #print(Ls)
        if Ls<=X:
            count+=1
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
i=[int(i) for i in input().split()]
n=i[0]
x=i[1]
L=[int(i) for i in input().split()]

sum=0
res=0
for step in range(n):
    if sum<=x:
        res+=1
        sum+=L[step]
    else:
        break
    
if sum<=x:
    res+=1

print(res)

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] = d[i-1] + L[i-1]

ans = sum([1 if dv <= X else 0 for dv in d])

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

# List = list([map(int, input().split())] for _ in range(N))
# List = [list(map(int, input().split())) for _ in range(N)]
List = list(map(int, input().split()))
# print(List)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def inpl():
    return list(map(int, input().split()))


N, X = inpl()
L = [0] + inpl()

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

print(ans)

Submission status: Accepted

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

N = int(N)
X = int(X)

l_list = input().split()

c = 1
d = 0
for i in range(N):
    d += int(l_list[i])
    if d <= X:
        c += 1
    else:
        break
print(c)

Submission status: Accepted

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

ans = 0
point = 0

for i in range(len(l_li)+1):
    if i == 0:
        ans += 1
    else:
        point = point + l_li[i-1]
        if point <= x:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
n, x = map(int,input().split())
a =  list(map(int,input().split()))
total = 0
for i, it in enumerate(a):
    total += it
    if total > x:
        break

if total <= x:
    i += 1
 
print(i+1)

Submission status: Accepted

Solution code:
cnt , a = map(int, input().split())
list_ = list(map(int,input().split()))
count = 1
b = 0

for i in list_:
  b += i
  if b > a:
    break
  else:
    count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
cnt = 1
for i in lst:
  sum += i
  if (sum <= 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=1
dist = 0
for i in l:
    dist+=i
    if dist>x:
        break
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
#python ABC_130_B.py

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

N = line1[0]
X = line1[1]

D = 0
count = 1

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

print(count)

Submission status: Accepted

Solution code:
N, X = list(map(int,input().split(" ")))
L = list(map(int,input().split(" ")))
l_sum = 0
flag = False
for i in range(N):
    l_sum += L[i]
    if l_sum>X:
        print(i+1)
        flag = True
        break
if not flag:    
    print(N+1)

Submission status: Accepted

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

Submission status: Accepted

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

if n==1 and sum(l)<=x:
  print(2)
elif sum(l) <= x:
  print(n+1)
else:
  for i in range(n+1):
    ll = l[:i]
    if sum(ll)>x:
      break
  print(len(ll))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N,X=map(int,input().split())
listL=list(map(int,input().split()))
D=0
for i in range(N):
  D+=listL[i]
  if D>X:
    print(i+1)
    sys.exit()
print(N+1)

Submission status: Accepted

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

count = 1
D = 0
for l in L:
    if D + l <= X:
        D = D + l
        count += 1
    else:
        break

print(count)

Submission status: Accepted

Solution code:
def acinput():
    return list(map(int,input().split(" ")))


N,X=acinput()
L=acinput()

count=0
h=0
for i in range(len(L)):
        count+=1
        h+=L[i]
        if h>X:
                break
        if i==len(L)-1:
                count+=1

if count==0:
        count=1
print(count)

Submission status: Accepted

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

cnt = 0
ans = [0]

for i in l:
    cnt += i
    if cnt <= x:
        ans.append(cnt)
print(len(ans))

Submission status: Accepted

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

pointList = [0]
for i in range(len(L)):
  x = pointList[i]+L[i]
  pointList.append(x)
    
num = 0
    
for i in range(len(pointList)):
  if pointList[i]<=X:
    num += 1

print(num)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
broken = False
for n in range(N):
    D += L[n]
    if D > X:
        broken = True
        break

if broken:
    print(n+1)
else:
    print(n+2)

Submission status: Accepted

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

cnt = 0
D_i = 0
for L in L_list:
    D_i = D_i + L
    if D_i <= X:
        cnt += 1

print(cnt + 1)

Submission status: Accepted

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

ans = 1
d = 0
while True:
    if ans >= n + 1:
        break
    d += L[ans - 1]
    if d > x:
        break

    ans += 1

print(ans)

Submission status: Accepted

Solution code:
x = int(input().split()[1])

ls = [int(n) for n in input().split()]

for index in range(len(ls)):
	list = ls[0:index]
	if sum(list) > x:
		print(index)
		break
	elif sum(list) == x:
		print(index + 1)
		break

	if index == len(ls) - 1:
		print(len(ls) + 1)

Submission status: Accepted

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

ans = [0]
for i, v in enumerate(L):
    v_next = ans[i] + v
    ans.append(v_next)

print(sum(i <= X for i in ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

l = input().split()
num = 0
for i,k in enumerate(l):
  num += int(k)
  if num<=x:
    out = i+2

print(out)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print (ans)

Submission status: Accepted

Solution code:
import numpy as np

N, X = map(int, input().split())
L = np.array([0] + list(map(int, input().split()))) 

res = sum([1 if e <= X else 0 for e in np.cumsum(L)])

print(res)

Submission status: Accepted

Solution code:
def LI(): return list(map(int, input().split()))

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

s = [sum(l[0:i]) for i in range(n+1)]
count = sum([x >= i for i in s])

print(count)

Submission status: Accepted

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

D = 0
count = 1

for i in range(N):
    D = D + int(L[i])
    if D <= X:
        count = count + 1

print(count)

Submission status: Accepted

Solution code:
n,x = (int(i) for i in input().split())  
l = [int(i) for i in input().split()] 
d = 0
i=0
while d <= x:
    try:
        d+=l[i]
    except:
        i+=1
        break
    i+=1

print(i)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
gen=0
for kai in range(N):
    gen=gen+L[kai]
    if(gen>X):
        kai=kai-1
        break

print(kai+2)

Submission status: Accepted

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

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

for i in range(0,N):
  D=D+L[i]
  if D<=X:
    count=count+1

print(count)

Submission status: Accepted

Solution code:

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

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

D = 0
count = 0

if D <= X :
    count += 1

for i in range(N):
    D_next = D + L[i]
    if(D_next <= X):
        count += 1
    D = D_next

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

if D <= X:
    print(cnt + 1)
else:
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
numN, numX = [int(i) for i in input().split()]
numList = [int(i) for i in input().split()]

D = 0
counter = 1
for Li in numList:
    D = D + Li
    if D > numX:
        break
    else:
        counter+=1
print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

    jump=[0]
    sum=0
    for i in range(n):
        sum+=point[i]
        jump.append(sum)

    count=0
    for k in range(n+1):
        if jump[k]<=x:
            count+=1
    print(count)

    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
n, x = list(map(int, input().split()))
llist = list(map(int, input().split()))
kai = 0
tsumu = 0
while tsumu <= x and llist != [] :
    kai += 1
    tsumu += llist.pop(0)
else :
    if tsumu <= x :
        kai += 1
print(kai)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def B(n, x, a):
    i = 0
    sum_n = 0
    while i < n:
        sum_n += a[i]
        if sum_n > x:
            break
        i += 1

    return i+1


if __name__ == "__main__":
    n, x = map(int, input().split())
    a = list(map(int, input().split()))

    print(B(n, x, a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, X = map(int,input().split())
L = list(map(int,input().split()))
pre = 0
counter = 1
if N == 1:
    if L[0] <= X:
        print(2)
    else:
        print(1)
else:
    for i in range(N):
        if pre + L[i] <= X:
            counter += 1
            pre += L[i]
        else:
            print(counter)
            exit()
        if i == (N-1):
            print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8


def main():
    # N = int(input())
    N, X = map(int, input().split())
    L = list(map(int, input().split()))

    ans = 0
    d = 0
    i = 0
    # for i in range(len(L)):
    #     ans += 1
    #     if d > X:
    #         break
    #     d += L[i]

    while d <= X and i <= N:
        if i < N:
            d += L[i]
        ans += 1
        i += 1
        # print(ans, d, i)

    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

count= 0
sumList=[]
sumList.append(0)

for i in range(N):
  if(sum(L[0:i+1]) > X):break
  sumList.append(sum(L[0:i+1]))

print(len(sumList))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

l = [int(x) for x in input().split()]

cnt = 1
now = 0
for i in l:
    now += i
    if now>x:
        break
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
a=list(input().split())
s=0
i=0
while s<=X:
    i+=1
    if i==N+1:
        break
    s+=int(a[i-1])
print(i)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    from bisect import bisect

    n, x = map(int, input().split())
    ls = list(map(int, input().split()))
    dist = [0]

    for i in range(1, n + 1):
        dist.append(dist[i - 1] + ls[i - 1])

    print(bisect(dist, x))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
class Bounding:
    def __init__(self):
        self.N, self.X = map(int, input().split())
        self.L = [int(i) for i in input().split()]

    def count_bound(self):
        d = 0
        counter = 1

        # 2回目から
        for l in self.L:
            d += l
            if d <= self.X:
                counter += 1
            else:
                break

        print(counter)


bounding = Bounding()
bounding.count_bound()

Submission status: Accepted

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

ans = 1
CurrentNum = 0

for i in L:
  CurrentNum += i
  
  if CurrentNum <= X:
    ans += 1
  else :
    break

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

n,x=intinput()
l=list(intinput())
d=[0]
for i in range(n):
    d.append(d[i]+l[i])
print([d[i]<=x for i in range(n+1)].count(True))

Submission status: Accepted

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

D = 0
cnt = 0
for i in L:
    D += i
    cnt += 1
    if D > X:
        break
if D <= X:
    cnt += 1
print(cnt)

Submission status: Accepted

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

sum = 1
now = 0

for i in range(len(l)):
    now += l[i]
    if now <= x:
        sum += 1
    else:
        break
print(sum)

Submission status: Accepted

Solution code:
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

X,A = Is()
lis = [0] + Is()
t = 0
for i in range(X+1):
    t += lis[i]
    if t > A:
        print(i)
        exit()
    elif i == X:
        print(X+1)
        exit()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
 
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))
 
N, X = mi()
L = li()
 
count = 1
D = 0
for i in range(N):
  D += L[i]
  if X >= D:
    count += 1
  else:
    break
 
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin

n, x = [int(x) for x in stdin.readline().rstrip().split()]
an = list(map(int, input().split()))

pos = 0

ans = 0
while ans < n:
    ans += 1
    pos += an[ans-1]
    if x < pos:
        break

if pos <= x:
    ans += 1

print(ans)

Submission status: Accepted

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

print(ans+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n,x = map(int, input().split())
l = list(map(int, input().split()))
pop = [0] * (n)
pre = 0
for idx,i in enumerate(l):
  pop[idx] = pre + i
  pre = pop[idx]

print(np.sum(np.array([0]+pop) <= x))

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 X < d:
        break
    count+=1

print(count)

Submission status: Accepted

Solution code:
# W, H, x, y = [int(i) for i in input().split()]
N, X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
D = 0
count = 0
answer = 1

while D <= X:
  if count + 1 > len(L):
    print(N+1)
    exit()
  D += L[count]
  count += 1
  answer += 1

print(answer - 1)

Submission status: Accepted

Solution code:
import sys

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

count = 1
D = 0
for k in L_list:
    D = D + k
    count = count + 1
    if D > X:
        print(count - 1)
        sys.exit()

print(N + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data = list(map(int,input().split()))
n = data[0]
x = data[1]
l = list(map(int,input().split()))
bound = [0]
for i in range(n):
        data = bound[i] + l[i]
        bound.append(data)
print(len(list(filter(lambda z:z<=x,bound))))

Submission status: Accepted

Solution code:
# coding: utf-8
N, X = map(int, input().split())
L = list(map(int, input().split()))
L.insert(0, 0)

dp = 0
i = 0
count = 0

for i in range(N+1):
    dp += L[i]
    if dp <= X:
        count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
ans = 1
bound = 0
for i,y in enumerate(l):
    bound += y
    if bound <= x and i <= n:
        ans += 1
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
from copy import deepcopy
import sys
from itertools import accumulate
N,X = map(int,input().split())
Llist = list(map(int,input().split()))

ruiseki = accumulate(Llist)
for i,r in enumerate(ruiseki,2):
    if r <= X:
        continue
    else:
        print(i-1)
        sys.exit()
print(i)

Submission status: Accepted

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

res = 1
x = 0
for l in L_list:
    x += l
    if x <= X:
        res += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
p = 0
for l in L:
    p += l
    if p > X:
        break
    else:
        cnt += 1
        
print(cnt)

Submission status: Accepted

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

mylist = input().split()
mylist = ['0'] + mylist

mycnt = 0
mysum = 0
for i in mylist: 
  mysum += int(i)
  if mysum <= X:
    mycnt +=1
  else:
    break
print(mycnt)

Submission status: Accepted

Solution code:
N,X=[int(i) for i in input().split()]
L=[int(i) for i in input().split()]
sL=0;j=0
for i in range(len(L)):
  sL+=L[i]
  if sL>X:break
  j+=1
print(j+1)