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:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    x, a = LI()
    if x < a:
        print(0)
    else:
        print(10)
    return

#B
def B():
    n, x = LI()
    L = LI()
    ans = 0
    c = 1
    for i in L:
        ans += i
        if ans <= x:
            c += 1
            continue
        break
    print(c)
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

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

CUMSUM = []
c = 0
for i in L:
    if c <= X:
        CUMSUM.append(c)
        c += i
if c <= X:
    CUMSUM.append(c)

print(len(CUMSUM[:X]))

Submission status: Accepted

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

for i in range(N):
  if A[i]+L[i]>X:
    break;
  A.append(A[i]+L[i])
  
print(len(A))

Submission status: Accepted

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

current = 0
result = 1
for _l in l:
    current += _l
    if current > x:
        break
    result +=1

print(result)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)

n,x = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
temp = 0
counter = 1
for index, value in enumerate(l):
    temp += value
    if temp <= x:
        counter += 1
print(counter)

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

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

print(ans)

Submission status: Accepted

Solution code:
# 2019/06/16
# AtCoder Beginner Contest 130 - B

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

cnt = 1
wd = 0

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

# Output
print(cnt)

Submission status: Accepted

Solution code:
from itertools import accumulate
n, x = map(int,input().split())
l = list(map(int, input().split()))
acc_l = list(accumulate(l))
cnt = 1
for i in range(n):
    if acc_l[i] <= x:
        cnt += 1
    else:
        break
print(cnt)

Submission status: Accepted

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

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

now = 0
LL = [now]
for l in L:
    now += l
    LL.append(now)
print(len(list(filter(lambda x:x<=X,LL))))

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 1
pos = 0

for _l in l:
  pos += _l
  if pos > x:
    break
  ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate

N, X = map(int, input().split())
AL = [0] + list(accumulate(list(map(int, input().split()))))

print(len(list(filter(lambda x: x <= X, AL))))

Submission status: Accepted

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

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

jump = 1
d = 0

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

print(jump)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=[int(j) for j in 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:
from itertools import accumulate
N, X = map(int, input().split())
L = map(int, input().split())
LA = list(accumulate(L))
C = sum([i <= X for i in LA])
print(C + 1)

Submission status: Accepted

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

Submission status: Accepted

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

result = 1
pos = 0

L = list(map(int, input().split()))
for i in L:
  pos += i
  if pos <= X:
    result += 1
  else:
    break
print(result)

Submission status: Accepted

Solution code:
import sys
from collections import Counter, deque, defaultdict

# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
# from functools import reduce
# from math import ceil, floor, log10, log2, factorial

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7

# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]

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

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

if d <= X:
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N,X = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]
s = 0
ans = 1
for l in L:
    s += l
    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()))

cnt = 1

D = 0
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())
count = 1
d = 0

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

Submission status: Accepted

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

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

t = 1
d = 0

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

Submission status: Accepted

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

D = 0
ans = 1
for l in L:
  D += l
  if D<=X:
    ans += 1
print ans

Submission status: Accepted

Solution code:
import numpy as np
N,X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
POS = [0]
for l in L:
    POS.append(POS[-1] + l)
POS = np.array(POS)
print(np.count_nonzero(POS <= X))

Submission status: Accepted

Solution code:
n, x = map(int, 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
    #print(d)
print(count)

Submission status: Accepted

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

now = 0
result = 1
for l in L:
    now += l
    if now <= X:
        result += 1

print(result)

Submission status: Accepted

Solution code:
import sys

N, X = list(map(int, sys.stdin.readline().strip().split(" ")))
L_list = list(map(int, sys.stdin.readline().strip().split(" ")))
d = 0
count = 1

for l in L_list:
    if d + l <= X:
        count += 1
        d += l
    else:
        break

print(count)

Submission status: Accepted

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

cur = 0
ans = 1

for hop in hoplist:
	cur += hop
	if cur > x:
		break
	ans += 1
	# print(cur,x)
print(ans)

Submission status: Accepted

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

D = [0] * (N+2)
answer = 1
for n in range(2,N+2):
  D[n] = D[n-1] + L[n-1]
  if D[n] <= X:
    answer += 1
    
print(answer)

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(2,N+2):
    d = d + L[i-2]
    if d <= X:
        count+=1

print(count)

Submission status: Accepted

Solution code:
#a, b, c, d = (int(i) for i in input().split())  
#W = [int(i) for i in input().split()] 
import math

N, X = (int(i) for i in input().split())
L_list = [int(i) for i in input().split()] 
#print(L_list)
sum_a = 0
cnt = 1
for l in (L_list):
    sum_a += l
    if sum_a > X:
        break
    cnt += 1
print(cnt)

Submission status: Accepted

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

L = list(map(int, input().split()))
#print(n, x, L)
D = 0
count = 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 = list(map(int, input().split(" ")))
L =  list(map(int, input().split(" ")))

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

Submission status: Accepted

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

Submission status: Accepted

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

s = 0
c = 1
for i in l:
  s += i
  if (s > lim):
    break
  c += 1

print(c)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l2=[0]
q=0
for i in range(n):
  q+=l[i]
  if q > k: break
  l2.append(0+l[i])

print(len(l2))

Submission status: Accepted

Solution code:
l = input().split()
N = int(l[0])
X = int(l[1])

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

# print(N, X, L)

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

print(N + 1)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
Ls = list(map(int,input().split()))
ans = 0
num = 0
for i,L in enumerate(Ls):
    #ans+=1
    num+=L
    if num>X:
        break
    else:
        ans+=1
print(ans+1)

Submission status: Accepted

Solution code:

N,X=map(int,input().split())
count=1

L=[]
LL=list(map(int,input().split()))
for i in range(N):
    c=0
    for j in range(i+1):

        c+=LL[j]
    L.append(c)
#print(L)

for i in range(N):
    if L[i]<=X:
        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
     cnt=1
     for i in l:
          if d+i>x:
               break
          else:
               d+=i
               cnt+=1
     print(cnt)
     
if __name__=='__main__':
     main()

Submission status: Accepted

Solution code:
N, X = list(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
    else:
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

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

ans = [0]

d = 0

for i in li:
    d += i
    ans.append(d)
    
cnt = 0

for i in ans:
    if i <= x:
        cnt += 1
    else:
        break
    
print(cnt)

Submission status: Accepted

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

zahyo = 0
kaisu = 1
for i in L:
    zahyo += i
    if zahyo <= X:
        kaisu += 1
    else:
        break

print(kaisu)

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys

n,x = [ int(x) for x in sys.stdin.readline().split() ]
lall= [ int(x) for x in sys.stdin.readline().split() ]

now  = 0
bound= 1
for li in lall:
    now+= li
    if now<=x: bound+=1
    else: break
#
print( bound )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N, X = LI()
    L = LI()
    x = 0
    count = 1
    for i in range(N):
        x += L[i]
        if x > X: break
        count += 1
    print(count)

main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
inp = input()
split_input = inp.split()
n = int(split_input[0])
x = int(split_input[1])
inp = input()
split_input = inp.split()
number = 0
count = 1
for st in split_input:
    l = int(st)
    number += l
    if number > x:
        break
    count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#B

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

d = 0
count = 0

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

print(count)

Submission status: Accepted

Solution code:
n,x =map(int,input().split())
l = list(map(int,input().split()))
temp = 0
ans = 0
if x >= 0:
    ans += 1

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

Submission status: Accepted

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


def solve(N, X, L):
    ds = [0] * (N +2)
    for i in range(1, N+1):
        ds[i] = ds[i-1] +   L[i-1]
    print(len([x for x in ds if x<=X]) - 1)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    L = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, X, L)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

current_position = 0
bound_count = 1
for L in nums:
    current_position += L
    if current_position <= X:
        bound_count += 1
print(bound_count)

Submission status: Accepted

Solution code:
N, X = map(int, input().split(" "))
LList = [int(i) for i in input().split(" ")]
count = 1
temp = 0

for i in LList :
    temp += i
    if temp > X :
        break
    count += 1
print(count)

Submission status: Accepted

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

count = 1
total = 0
for l in L:
  total += l
  if total > X:
    break

  count += 1

print(count)

Submission status: Accepted

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

count = 1
d = 0
for li in l:
    d += li
    if d <= x:
        count += 1

print(count)

Submission status: Accepted

Solution code:
# coding: utf-8
import time
import re
import math

def main():
    N,X=map(int,input().split())
    L=list(map(int,input().split()))
    count=0
    num=0
    for a in range(N+1):
        if a>0:
            num=num+L[a-1]
        if num<=X:
            count+=1
    print(count)
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#n=int(input())
# global n,A,s,memo,mx,mn,L,B

Submission status: Accepted

Solution code:
import bisect
N, X = map(int, input().split())
L = list(map(int, input().split()))
H = [0]

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

print(bisect.bisect_right(H, X))

Submission status: Accepted

Solution code:
import numpy as np
import bisect

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

L_cumsum = np.array(L).cumsum()
ans = 1 + bisect.bisect_right(L_cumsum, X)

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

Submission status: Accepted

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

cnt = 1
nowL = 0

for i in range(N) :
    nowL += l[i]
    if nowL <= X :
        cnt += 1
    else :
        break

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate

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

B = [0] + L
B = list(accumulate(B))

cnt = 0
for i in range(len(B)):
    if B[i] <= X:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, x = map(int, input().split())
    l = [int(li) for li in input().split()]
    d = s = 0

    for i in l:
        if d <= x:
            s += 1
        d += i

    if d <= x:
        s += 1

    print(s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
N, X = list(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
    cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

d = 0
cnt = 0

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

print(cnt)

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:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, X = map(int, raw_input().split())
L_arr = map(int, raw_input().split())

over = False
over_i = 0
for i in range(0, N+1):
  if over:
    break
  if i == 0:
    d = 0
  else:
    d = d + L_arr[i-1]
    if d > X:
      over = True
      over_i = i
      break

if over:
  print(over_i)
else:
  print(N+1)

Submission status: Accepted

Solution code:
N, X = [int(x) for x in input().split()]
L_list = [int(x) for x in input().split()]
d = 0
cnt = 1
for L in L_list:
    d += L
    cnt += (d <= X)
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, x = [int(item) for item in input().split()]
l = [int(item) for item in input().split()]
bound = 0
cnt = 1
for item in l:
    bound += item
    if bound > x:
        break
    else:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

bound = 1
xpoint = 0
for Li in L:
    xpoint +=  Li
    if xpoint > X:
        break
    else:
        bound += 1

print(bound)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from itertools import accumulate
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
l_acc = accumulate(l)
ret = 1
for i in l_acc:
    if i > x:
        break
    ret+=1
print(ret)

Submission status: Accepted

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


for c in com:
    if c <= X:
        ans +=1



print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

count = 1
d=0

for i in L:
    d = d + i
    if d>X:
        break
    count+=1

print(count)

Submission status: Accepted

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

a = [0]*(n+1)
for i in range(len(l)):
    a[i+1] = a[i] + l[i]

ans = 0
for i in a:
    if i <= x:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

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

l_ = 0
res = 1
for i in l:
    l_ += i
    if l_ > x:
        break
    res += 1

print(res)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N,X=LI()
IL=LI()

res = 1
cur = 0
for i in IL:
    cur += i
    if cur <= X:
        res += 1

print(res)

Submission status: Accepted

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

d=0

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

Submission status: Accepted

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


def solve(N, X, L):
    d = 0
    for i in range(N):
        if d + L[i] > X:
            return i + 1
        d += L[i]
    return N + 1


if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))

Submission status: Accepted

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

ans = 1
cur = 0

for l in L:
    cur += l
    if cur > x:
        break
    ans += 1

print(ans)