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()))


x = 0
if L[0] >= X:
    print(1)
    exit()
for i, n in enumerate(L):
    x += n
    if x > X:
        print(i+1)
        exit()
print(N+1)

Submission status: Accepted

Solution code:
N, X = (int(x) for x in input().split())
list_a = [int(N) for N in input().split()]
a=0
count_a = 1
end = False
for i in range(0,N):
    a = list_a[i] + a
    if a <= X:
        count_a += 1
    else:
        end = True
print(count_a)

Submission status: Accepted

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

    #while True:
        #i = 0
        #max += l[i]
        #if max < x:
            #ans += 1
        #i += 1

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

main()

Submission status: Accepted

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

d = 0
ans = 0

if d <= x:
    ans = 1
else:
    ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter as D, defaultdict as dd
from math import factorial as ft, ceil as aron
from fractions import gcd as pg 
from bisect import insort as ins, bisect_left as bl, bisect_right as br
import sys

#sys.stdin=open("./testfile.txt","r")
raw_input=sys.stdin.readline

f1=lambda : map(int,raw_input().split())
f2=lambda : map(int,list(raw_input()))
f3=lambda : int(raw_input())
f4=lambda : raw_input().rstrip()

f1=lambda : map(int,raw_input().split())
n,p= f1()
l= f1()
d=[0]*(n+1)
for i in xrange(1,n+1):
	d[i]=d[i-1]+l[i-1]
ans=-1
for i in xrange(1,n+1):
	if d[i]>p:
		ans=i
		break
	elif d[i]==p:
		ans=i+1
		break
if ans==-1:
	ans=n+1
print ans

Submission status: Accepted

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

for ii in range(1,n+1):
    D[ii] = D[ii-1] + L[ii-1]
    if D[ii] <= x:
        ans += 1

print(ans)

Submission status: Accepted

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

if n == 0:
    print(0)
else:
    li = list(map(int,input().split()))
    if x == 0:
        print(1)

    else:

        sum1 = 0
        v = 1

        for l in li:
            sum1 += l
            if sum1 > x:
                break
            v += 1


        print(v)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = 1

s = 0
for i in l:
    s = s + i
    if s > x: break
    a = a + 1

print(a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
count = 1
current = 0

if sum(l) <= x:
    print(n+1)
else:
    while current <= x:
        current += l[count-1]
        count += 1
    print(count-1)

Submission status: Accepted

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

cnt = 0
total = 0

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


print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 1
now = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
count = 1
for i in range(n):
    sum = sum + L[i]
    if sum > x:
        break
    count = count + 1

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
 
N,X = [int(v) for v in input().rstrip('\n').split()]
distance = np.array([int(v) for v in input().rstrip('\n').split()])

count = 1
pos = 0
 
for n in range(N):
  pos += distance[n]
  if pos <= X :
    count += 1 
 
print(count)

Submission status: Accepted

Solution code:
import sys

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

N = list[0]
X = list[1]

i = 1
total = 0

for len in length_list:
  total = total + len
  if total <= X:
    i = i + 1
    if i == N + 1:
      print(i)
  else:
    print(i)
    sys.exit()

Submission status: Accepted

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

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

print(i+1)

Submission status: Accepted

Solution code:
def bound(n, x, l):
    coordinate = 0
    for i in range(n):
        coordinate += l[i]
        if x < coordinate:
            return i
        else:
            continue
    return n


n, x = map(int, input().split())
l = list(map(int, input().split()))
countbound = bound(n, x, l)
print(countbound+1)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
L=list(map(int,input().split()))
c=0
s=0
while(s<=x):
    if c == n:
        c+=1
        break
    s+=L[c]
    c+=1

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

n, x = map(int, input().split())
li = map(int, input().split())
b = 1
d = 0
for l in li:
    d += l
    if d > x:
        break
    else:
        b += 1
print(b)

Submission status: Accepted

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

haneru = 0
summ = 0
for i in range(n):

    t = l[i]
    haneru += int(t)
    if haneru <= x:
        summ += 1
print(summ+1)

Submission status: Accepted

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

ans = 0
sum = 0
L.insert(0, 0)

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

print(ans)

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)
        exit()

print(i + 2)

Submission status: Accepted

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

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

print(i+1)

Submission status: Accepted

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

Submission status: Accepted

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

D = 0
ans = 0

for l in L:
    if D <= X:
        ans += 1
    else:
        break
    D += l
else:
    if D <= X:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

D = []
for i in range(N+1):
    if i == 0:
        D += [0]
    else:
        D += [D[i-1] + L[i-1]]

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

print(counter)

Submission status: Accepted

Solution code:
from collections import deque

N, X = map(int, input().split())
L = list(map(int, input().split()))
d = deque([0])
current = 0
for i in range(N):
    current = current + L[i]
    d.append(current)

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

Submission status: Accepted

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

now = 0
a = 0
for i in range(N):
    if now <= X:
        now += L[i]
        a += 1
    else:
        break

if now <= X:
    a += 1

print(a)

Submission status: Accepted

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

count = 1
for i in range(len(L_list)):
  cood = cood + L_list[i]
  if cood <= X:
    count += 1
  else:
    break
print(int(count))

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
a = 0
b = 0
c = [0]
d = []
for val in L:
  a += 1
  b += val
  c.append(b)
for i in c:
  if i <= X:
    d.append(i)
print(len(d))

Submission status: Accepted

Solution code:
from itertools import accumulate
N,X = map(int,input().split())
listA = list(map(int,input().split()))

B = [0] + listA
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:
N,X=map(int,input().split())
L=[i for i in map(int,input().split())]
count=1
total=0
for num in L:
    total+=num
    if total>X:
        print(count)
        break
    count+=1
if total<=X:
    print(count)

Submission status: Accepted

Solution code:
from sys import stdin, stdout

if __name__ == "__main__":
	N, X = stdin.readline().split(" ")
	N = int(N)
	X = int(X)

	L = []
	for e in stdin.readline().split(" "):
		L.append(int(e))

	start = 0
	i = 1
	cnt = 1
	while i <= N and start <= X:
		start = start + L[i-1] 
		if start <= X:
			cnt += 1
		i += 1
	
	print (cnt)

Submission status: Accepted

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

for i in range(2,n+2):
  if sum(l[:i-1]) <= x:
    cnt += 1
    
print(cnt)

Submission status: Accepted

Solution code:
s = input().split()
n = input().split()
kaisuu = int(s[0])
sum = int(0)
count = 0;

for i in range(kaisuu):
    if (sum <= int(s[1])):
        sum += int(n[i])
        if (sum <= int(s[1])):
        	count+=1

print(count+1)

Submission status: Accepted

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

Submission status: Accepted

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

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()]
 
D=[0]
for i,Li in enumerate(L):
  D.append(D[-1]+Li)
D=np.array(D)
print(np.sum(D<=X))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
cnt = 1
i = 0
now = 1
ans = [1]*(x+l[-1])
sum = 0
for i in range(n):
    for j in range(sum + l[i], x+l[-1]):
        ans[j] += 1
    sum += l[i]
print(ans[x])

Submission status: Accepted

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

print(i+1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import itertools 
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
k = list(itertools.accumulate(l))
k.append(0)
k.sort()
ii = 0
for i in k:
    if(i<=x):
        ii+=1
        continue
    else:
        break
print(max(1,ii))

Submission status: Accepted

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


cnt = 0
sum = 0
size = len(l_list)


for i in range(size):
  sum = sum + int(l_list[i])

  if int(sum) <= int(x):
    cnt = cnt + 1


print(cnt+1)

Submission status: Accepted

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

sum = 0
result = 1

for i in range(N):
    sum += li[i]
    if sum <= X:
        result += 1
    else:
        break

print(result)

Submission status: Accepted

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

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

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

Submission status: Accepted

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


    answer = 0
    for i in range(1, N+2):
       if i == 1:
           D = 0
       else:
           D = D + L_list[i-2]

       if D <= X:
            answer += 1

    print(answer)

Submission status: Accepted

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

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

    ans = 1
    d = 0

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, X = [int(s) for s in input().split()]
Ls = [int(s) for s in input().split()]
d, ans = 0, 0
for l in Ls:
    if d <= X:
        ans += 1 
    d += l
if d <= X:
   ans += 1
print(ans)

Submission status: Accepted

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

count = 1
dis = 0

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

print(count)

Submission status: Accepted

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


def solve(N: int, X: int, L: "List[int]"):
    x = 0
    pos = [0]
    for i,l in enumerate(L):
        x += l
        pos.append(x)

    for i,p in enumerate(pos):
        if p > X:
            print(i)
            return
    print(N+1)





# 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())
l=list(map(int,input().split()))
d=0
ans=1
while d<=x and ans<=n:
 d+=l[ans-1]
 if d>x:
  break
 else:
  ans+=1
print(min(ans,n+1))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

D = 0
cnt = 1

for L in LS:
    D += L
    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()))

t=0
ans=0

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

Submission status: Accepted

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

Submission status: Accepted

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

#print(L)
#print(D)

for i in range(N):
  #print(i+2,end=" ")
  #print(L[i],end=" ")
  D=D+L[i]
  #print(D)
  if D>X:
    print(i+1)
    exit()
    
print(N+1)

Submission status: Accepted

Solution code:
from itertools import accumulate
N,X = map(int, input().split())
Ls = [0]+list(map(int, input().split()))
D = list(accumulate(Ls))

flg = False
for i,d in enumerate(D):
    if d>X:
        flg = True
        break
if flg:
    print(i)
else:
    print(i+1)

Submission status: Accepted

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

def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    L.insert(0, -1)

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

result = 0
bound_count = 1
for i in range(N):
  result += inputs[i]
  if X < result:
    break
  bound_count += 1

print(bound_count)

Submission status: Accepted

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

cnt = 0
di = 0

if sum(l) < x or sum(l) is x:
  print(n + 1)
else:
  for i, li in enumerate(l, 1):
    di += li
    if di > x:
      i -= 1
      break
    if di is x:
      break
    
  print(i+1)

Submission status: Accepted

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

Submission status: Accepted

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

d_i = 0
ans = 1
for l_i_val in l_i:
    d_i += l_i_val
    if d_i <= x:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
l = list(map(int,input().split()))
#print(l)
d = preD = 0
i = 0
for i in range(N):
    d = preD + l[i]
    preD = d
    #print(i+1,d)
    if d == X:
        print(i+2)
        break
    elif d > X:
        print(i+1)
        break
else:
    print(N+1)

Submission status: Accepted

Solution code:
#N回跳ねるボール　1≤X≤10000　Xは領域
N, X = map(int, input().split())
#Lははねた距離
length = list(map(int, input().split()))

#バウントしたかず
count_total = 1
#最初の位置
now = 0
  
for count in range(N):
  #もし領域よりも小さければもう一回跳ねる
  now = now + length[count]
  if now <= X:
    count_total = count_total + 1

print(count_total)

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

print(count)

Submission status: Accepted

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

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

D = 0
counts = 1

for bound in bounds:
    D += bound
    if D > X:
        break

    counts += 1

print(counts)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
c=0
for i,a in enumerate(L):
	c+=a
	if c>X:
		print(i+1)
		exit()
print(len(L)+1)

Submission status: Accepted

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

temp = 0
sum = 0
a = [0]
for i in range(len(lis)):
    sum = temp + lis[i]
    a.append(sum)
    temp = sum

count = 0
for i in range(len(a)):
    if(a[i] <= x):
        count += 1

print(count)

Submission status: Accepted

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

count = 1
sum_val = 0
for val in L:
    sum_val += val
    if sum_val <= X:
        count += 1

print(count)

Submission status: Accepted

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

lenL = 0

for i in range(len(L)):
    lenL += L[i]
    i += 1

if lenL <= X:
    print(N+1)
else:
    j = 1
    sumL = L[0]

    while sumL <= X:
        sumL += L[j]
        j += 1
    print(j)

Submission status: Accepted

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

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

f = [0] * (n + 1)

f[0] = 0
f[1] = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

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

position = 0
count = 1

for l in list_l:
    position += l
    if position <= X:
        count += 1

print(count)

Submission status: Accepted

Solution code:
# coding: utf-8
N,x = [int(i) for i in input().split()]
l = input().split()
count = 1 #bound at 0
ordinate = 0
for i in range(N):
    ordinate += float(l[i])
    if ordinate > x:
        break
    count += 1
print(count)

Submission status: Accepted

Solution code:
import sys

N = map(int, raw_input().strip().split())
L = map(int, raw_input().strip().split())
pos = 0
for i in range(N[0]):
    if(L[0] > N[1]):
        print(0)
        sys.exit()
    if (pos + L[i]) > N[1]:
        print(i+1)
        sys.exit()
    else:
        pos +=L[i]
    
print(N[0]+1)

Submission status: Accepted

Solution code:
def input_from_console():
    n, x = map(int, input().split())
    l_list = list(map(int, input().split()))
    return n, x, l_list


def solve(n, x, l_list):
    result = 0
    position = 0
    for i in range(n):
        if position > x:
            return result
        result +=1
        position += l_list[i]
    if position > x:
        return result 
    else:
        return result + 1



def main():
    n, x, l_list = input_from_console()
    print(solve(n, x, l_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Submission status: Accepted

Solution code:

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

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

    result = 1
    D = 0

    for i in range(0, n):
        Dn = D + L[i]

        if Dn <= x:
            result += 1

        D = Dn



    return result



if __name__ == "__main__":
    print(main())

Submission status: Accepted

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

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

L2=[0]
for i in L:
  L2.append(L2[-1]+i)
  if X < L2[-1]:
    print(len(L2)-1)
    exit()

print(len(L2))

Submission status: Accepted

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

for i in range(1, N+1):
    D[i] = D[i-1] + L[i-1]

for d in D:
    if d <= X:
        cnt += 1
    else:
        break

print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
info = list(map(int, input().split(' ')))
N, X = info[0], info[1]
info = list(map(int, input().split(' ')))
len = 0

count = 1

for for1 in info:
  len += for1
  if len <= X:
    count += 1
  else:
    break

print(count)

Submission status: Accepted

Solution code:
N, X = [int(i) for i in input().split()]
Ls = [int(l) for l in input().split()]
d = 0
res = 1
for i, Li in enumerate(Ls):
    d += Li
    if d > X:
        break
    res += 1
print(res)

Submission status: Accepted

Solution code:
import sys
import numpy as np

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

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

x = np.zeros(N+1)

for n in range(1,N+1):
    x[n] = x[n-1] + L[n-1]
    if x[n] > X:
        print(n)
        sys.exit()

print(N+1)

Submission status: Accepted

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

d = 0
c = 1
for i in l:
	d = d + i
	if d>x:
		print(c)
		exit()
	else:
		c+=1
print(c)

Submission status: Accepted

Solution code:
from sys import stdin

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

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

Submission status: Accepted

Solution code:
line = input().split()
N = int(line[0])
X = int(line[1])
line = [int(p) for p in input().split()]
pos = 0
count = 1
for i in range(len(line)):
  pos += line[i]
  if pos > X:
    break
  count +=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

ls2 = []
ls2.append(0)
for i in range(n):
  ls2.append(ls1[i]+ls2[i])
  
ct=0
for j in range(n+1):
  if ls2[j]<=x:
    ct += 1
print(ct)

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
a = input().split()
count=1
for i in range(n):
  if sum(int(j) for j in a[:i+1]) <= k:
    count+=1
    continue
  else:
    break
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

bounce = [0] + [ sum(ls[:i]) for i in range(1, len(ls)+1) ]

for i, v in enumerate(bounce):
  if v > x:
    print(i)
    break
else:
  print(len(bounce))

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
l.append(0)
p = 0
i = 0
while p <= x and l:
    i += 1
    p += l.pop(0)
print(i)

Submission status: Accepted

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

bound_times = 0
now_point = 0

for i in L:
    if now_point > X:
        break
    now_point += i
    bound_times += 1

if now_point <= X:
    bound_times += 1
    
print(bound_times)

Submission status: Accepted

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

Submission status: Accepted

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

boundlist = list(map(int,input().split()))
boundlist.insert(0,0)
count = 0
ans = 0
for i in boundlist:
    count += i
    if count <= X:
        ans += 1
print(ans)