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

lst_A = (input().split())

count = 1

dis = 0

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

print(count)

Submission status: Accepted

Solution code:
import numpy as np
N,X=map(int,input().split())
L=list(map(int,input().split()))
       
L=np.array(L)
D=np.zeros(N+1)
s=1
for i in range (1,N+1):
    D[i]=D[i-1]+L[i-1]

    if D[i]<=X:
        s+=1
    else:
        break
       
print (s)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 25 12:46:40 2019

@author: YudNK
"""

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

Submission status: Accepted

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

p = [0]
last = 0
for dist in L:
    last = last + dist
    p.append(last)

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

Submission status: Accepted

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

Submission status: Accepted

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

ns=0
ans = 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
line = input().split()
pos = [0]
for i in range(n):
	l = int(line[i])
	pos.append(pos[i]+l)

cnt = 0
for p in pos:
	if p <= x:
		cnt += 1
	else:
		break
print(cnt)

Submission status: Accepted

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

print(c)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
l_list = list(map(int, input().split()))
l_list = [0] + l_list
d = 0
for i, l in enumerate(l_list):
    if d + l > X:
        break
    d += l
if sum(l_list) <= X:
    i = N + 1
print(i)

Submission status: Accepted

Solution code:
import numpy as np

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

L = np.array(L)
D = np.zeros(N+1)

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

print(count)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

distance = 0
jump_number = 1
for l in L:
    distance += l
    if distance > X:
        break
    else:
        jump_number += 1

print(jump_number)

Submission status: Accepted

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

p = 0
cnt = 1

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

Submission status: Accepted

Solution code:
A, B = input().split()
C = input().split()
count = 1
step = 0
for i in range(int(A)):
  step += int(C[i])
  if step > int(B):
    break
  count += 1
print(count)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=[int(i) for i in input().split()]
l=list(L)
D=[]
d=0
D.append(d)
for i in range(2,N+2):
  d+=l[i-2]
  D.append(d)
bound=[i for i in D if i<=X]
print(len(bound))

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L_list=(input().split())
Bound_list=[0]
for i in range(1,N+1):
  count=int(L_list[i-1])+int(Bound_list[i-1])
  Bound_list.append(count)
Answer_list=list(filter(lambda n:n<=X,Bound_list))
print(len(Answer_list))

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = [int(i) for i in 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:


def solve():
    N, X = map(int, input().split())
    L = [int(i) for i in input().split()]
    bound = 0
    count = 1
    for Li in L:
        bound += Li
        if bound <= X:
            count += 1
        else:
            break
    print(count)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import sys

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

    cnt = 1
    D = 0
    for a in A:
        D += a
        if D > X:
            break
        cnt += 1

    return cnt


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

Submission status: Accepted

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

C=D=0
while C<N:
  D+=L[C]
  if D>X:
    break;
  C+=1
print(C+1)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
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()))
D=0
cnt=1
for i in L:
    D=D+i
    if D>X:
        break
    cnt+=1
print(cnt)

Submission status: Accepted

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

cnt = 1
sum_ = 0

for i in list:
    sum_ += i
    if sum_ > X:
        break
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
_,x=map(int,input().split())
l=list(map(int,input().split()))
tmp=0
for i,j in enumerate(l):
  tmp+=j
  if tmp>x:
    print(i+1)
    exit()
print(len(l)+1)

Submission status: Accepted

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

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

c = 1
dx = 0

for i in range(len(l)):
    dx += l[i]

    if dx > X:
        break
    c += 1


print(c)

Submission status: Accepted

Solution code:
s = list(map(int,input().split()))
N = s[0]
X = s[1]
L = list(map(int,input().split()))
a = 0
d = 0
while d <= X:
  if a >= N:
    a = N+1
    break
  else:
    d += L[a]
    a += 1 

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

ret = 0
Ds = []

for i in range(N+1):
  if i==0:
    Ds.append(0)
  else:
    Ds.append(Ds[-1]+Ls[i-1])
  if Ds[-1]<=X:
    ret += 1
    continue
print(ret)

Submission status: Accepted

Solution code:
def load_input_int():
    return map(int, input().split())
    
N, X = load_input_int()
Ls = load_input_int()

cur_position = 0
ret = None
for idx, l in enumerate(Ls):
    cur_position += l
    if cur_position > X:
        ret = idx + 1
        break
print(ret if ret is not None else N+1)

Submission status: Accepted

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

n = 1
d = 0
for i in arr:
    d += i
    if d > X:
        break
    n += 1
print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num, max = (int(i) for i in input().split())
list = [int(i) for i in input().split()]

cnt = 0
ans = 1
for n in list:
    cnt = cnt + n
    if cnt <= max:
        ans = ans + 1

print(ans)

Submission status: Accepted

Solution code:
N, X_MAX=input().split()
L = input().split()
count_i = 1
X = 0

for L_n in L:
    X += int(L_n)
    if int(X_MAX) < X:
        break
    count_i += 1
print(count_i)

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

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

j = 1
jx = 0
for i in range(len(l)):
    jx += l[i]
    if jx > x:
        break
    j += 1

print(j)

Submission status: Accepted

Solution code:
def bounding(N: int, X: int, L: list)->int:
    D = [0] * (N+1)
    for i, l in enumerate(L):
        D[i+1] = D[i] + l

    l, r = 0, N+1
    while r-l > 1:
        m = (l+r)//2
        if D[m] <= X:
            l = m
        else:
            r = m

    return r


if __name__ == "__main__":
    N, X = map(int, input().split())
    L = [int(s) for s in input().split()]

    ans = bounding(N, X, L)
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,x = map(int, input().split())
Larray = list(map(int, input().split()))
d = 0
result = 1
for num in Larray:
    d = d + num
    if d <= x:
        result = result + 1
print(result)

Submission status: Accepted

Solution code:
import sys
N, X = (int(x) for x in input().split())
L = list(map(int, input().split()))

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

print(N+1)

Submission status: Accepted

Solution code:
import numpy
N, X = map(int, input().split())
L_list = list(map(int, input().split()))
L_list.insert(0, 0)
res = numpy.cumsum(L_list)
res += [0]
result = len(res[res<=X])
print(result)
#print(result)

Submission status: Accepted

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

d0 = 0
#d1 = d0 + L[0]

D = []
D.append(d0)

for i in range(1,N+1):
    D.append(D[i-1] + L[i-1])
    
print(len([i for i in D if i <= X ]))

Submission status: Accepted

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

#argv=sys.argv

#print(argv)

argv=input()
argv1,argv2=argv.split(" ")

argv=input()
a=argv.split(" ")

n=int(argv1)
x=int(argv2)

aa=[]
for i in a:
    aa.append(int(i))

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


print(count)

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

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

    num = 0
    sum = 0
    for e in l:
        if sum + e <= x:
            num += 1
            sum += e
        else:
            break

    print(num)

Submission status: Accepted

Solution code:
#not accept

from sys import stdin
from collections import defaultdict

N, X = [int(x) for x in stdin.readline().rstrip().split()]
L = []
L = [int(x) for x in stdin.readline().rstrip().split()]

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

max = 0
for i in range(1,N+1):
    if D[i] <= X:
      max = i
    else:
      break

print(max+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(k)

Submission status: Accepted

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

pos = 0
for i in range(n):
  pos += l_list[i]
  if pos > x:
    break
if pos <= x:
  i += 1
print(str(i + 1))

Submission status: Accepted

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

Submission status: Accepted

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

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

sum_lst = list()
sum_lst.append(0)
for i in range(0, len(l)):
    sum_lst.append(sum_lst[i]+l[i])

cnt = 0
for i in range(0, len(sum_lst)):
    if sum_lst[i] <= X:
        cnt += 1
    else:
        break

print(cnt)

Submission status: Accepted

Solution code:
from itertools import accumulate as ac

n, x = map(int, input().split())
lst = list(map(int, input().split()))
lst_ac = list(ac(lst))
lst_ans = [0] + lst_ac


ans = 0
for a in lst_ans:
    if a > x:
        break
    ans += 1


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_input1 = input()
_input2 = input()
N, X = tuple([int(a) for a in _input1.split(' ')])
l_list = [int(a) for a in _input2.split(' ')]

length = 0
cnt = 0

for l in l_list:
    if length > X:
        break
    length += l
    cnt += 1

if length <= 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
while len(L) > 0:
    D += L.pop(0)
    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()))

D = 0
count = 1
for i in range(len(L)):
    D += L[i]
    if D <= X:
        count += 1
    else:
        break

print(count)

Submission status: Accepted

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

D = 0
cnt = 1
i = 0
while True:
    D = D + L[i]
    if D > X:break
    i += 1
    cnt += 1
    if i >= N:break
print(cnt)

Submission status: Accepted

Solution code:
from itertools import accumulate

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

ans = 1 + sum(acc <= X for acc in accumulate(L))

# 出力
print(ans)

Submission status: Accepted

Solution code:
from itertools import accumulate

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

ans = sum(acc <= X for acc in accumulate(L)) + 1

# 出力
print(ans)

Submission status: Accepted

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

cnt = 1
distance = 0

for bound in bounds:
  distance += bound
  if distance <= x:
    cnt += 1
  else:
    break
    
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
pos = 0
for a in L:
    pos += a
    if pos > x:
        break
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
x1 = list(map(int,input().rstrip().split(" ")))
x2 = list(map(int,input().rstrip().split(" ")))

def makey(x1,x2):
  total = 0
  for i in range(x1[0]):
    total += x2[i]
    if total > x1[1]:
      return i
  return i+1
y = makey(x1,x2)
print(y+1)

Submission status: Accepted

Solution code:
n,x=list(map(int,input().split()))
L=list(map(int,input().split()))
List=[]
d=0

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

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,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())

l = list(map(int, input().split()))
al = [0] * (n + 1)

count = 0
for i in range(0, n):
    al[i + 1] = al[i] + l[i]

for e in al:
    if e <= x:
        count += 1
    else:
        break

print(count)

Submission status: Accepted

Solution code:
n, x = list(map(int, input().split(" ")))
l_list = list(map(int, input().split(" ")))
points = [0]
p = 0
for l in l_list:
  p += l
  points.append(p)
result = list(filter(lambda i : i <= x, points))
print (len(result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x = map(int, input().split())
l = map(int, input().split())
count = 1
for li in l:
  x = x - li
  if x < 0:
    break
  else:
    count = count+1
print(count)

Submission status: Accepted

Solution code:
import re
import numpy as np
 
N, X = [int(i) for i in re.split(" ", input())]
Ls = [int(i) for i in re.split(" ", input())]
Ds = np.cumsum(Ls)
counts = np.sum(Ds <= X) + 1
print(counts)

Submission status: Accepted

Solution code:
factor_1, factor_2 = list(map(int, input().split()))

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

D_pre = 0
count = 0

if(D_pre <= factor_2):
	count += 1


for i in range(len(L)):
	D_pre = D_pre + int(L.pop(0))
	
	if(D_pre <= factor_2):
		count += 1

print(count)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
N, X = map(int, input().split())
Ls = map(int, input().split())

bound_position = 0
bound_num = 1
for L in Ls:
    bound_position += L
    if bound_position > X:
        break
    bound_num += 1

print(bound_num)

Submission status: Accepted

Solution code:
a,b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]

cur = 0
res = 1

for i in c:
    cur += i
    if cur <= b:
        res += 1
    else:
        break

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

#数直線上をN+1回跳ねるボールがあり、1回目は座標D1=0, i回目は座標Di=D(i-1)+L(i-1) (1<=i<=N+1)で跳ねます
#数直線がX以下の領域でボールが跳ねる回数は何回でしょうか

#Given:
    #N X
    #L1, L2, L3, ... LN-1, LN


#N, Xを格納
#inputをsplit関数でlistに変換
i = input()
lis = i.split()
#listの要素をN, Xに格納
N = int(lis[0])
#print("Nは"+str(N))
X = int(lis[1])
#print("Xは"+str(X))

#L1, L2, L3, ... LN-1, LNを格納
#inputをsplit関数でlistに変換
i = input()
lis = i.split()
#lisをLに順に格納
L = list()
for k in lis:
    #print(k)
    L.append(int(k)) #数値に変換
#print(L)

#NとLの数を確認
if N != len(L):
    print("跳ねる回数と跳ねる位置のリスト数が一致していません。")
    sys.exit()

#D1, D2, D3 ... DN-1, DNを生成
D = list()

#D0 = 0
D.append(0)
for k in range(0,len(L)):
    D.append(D[k]+L[k]) #D0～DN
#print(D)

#Dのうち、X以下の要素をcount
n = sum(test <= X for test in D)  # 真偽値リストを作って True の数を合計する方法

#戻り値n
print(n)

Submission status: Accepted

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

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

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

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

print(ans)

Submission status: Accepted

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

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

print(num)

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 = D + i
    if D > X:
        break
    else:
        ans += 1

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

bounds = 1
position = 0
for distance in L:
  position += distance
  if position <= X:
    bounds += 1
  else:
    break

print(bounds)

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 l:
  a += i
  if a > x:
    break
  else:
    n += 1

print(n)

Submission status: Accepted

Solution code:
import itertools
import bisect
n, x = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + list(itertools.accumulate(a))
print(bisect.bisect_right(a, x))

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
time = 2
list = [list(map(int,input().split())) for i in range(time)] #list[0]にnとxが,list[1]にL1~Lnが入る
n, x = [i for i in list[0]]

y = [0]
n = 1
for i in range(len(list[1])):
    y.append(y[i] + list[1][i])
    if (y[i+1] > x):
        break
    n += 1


print(n)

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()]
res = 1
sumVal = 0
for i in l:
    sumVal += i
    if sumVal <= x:
        res += 1
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

s = 1
d = 0
for it in li:
  d += it
  if (d<=X):
    s+=1
print ( s )

Submission status: Accepted

Solution code:
num = [int(i) for i in input(). split()]
bound_num = [int(j) for j in input().split()]
bound_length = 0
count = 1

for i in range(len(bound_num)):
    bound_length += bound_num[i]
    if bound_length <= num[1]:
        count += 1

print(count)

Submission status: Accepted

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

cnt = 0
ans = 1

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

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
indata1 = input().split()
indata1 = list(map(int,indata1))
indata2 = input().split()
indata2 = list(map(int,indata2))

arrD = [0]
arrL = indata2.copy()

for i in range(1,indata1[0]+1):
    arrD.append(arrD[i-1]+arrL[i-1])

cnt = 0
for d in arrD:
    if d <= indata1[1]:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

counter = 0
for i in bound:
    if i <= X:
        counter += 1
    else:
        break
print(counter)

Submission status: Accepted

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

for i in l:
    d.append(d[-1] + i)

for i in d:
    if x < i:
        break
    count += 1

print(count)

Submission status: Accepted

Solution code:
N,X=list(map(int,input().strip().split(' ')))
L=list(map(int,input().strip().split(' ')))
index=0
Bounce=[0]
for i in range(len(L)):
    
        
    Bounce+=[L[i]+Bounce[-1]]
    
count=0
for x in Bounce:
    if x<=X:
        count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
sum = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

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
length=0
for i in L:
	length+=i
	if length>X:
		break
	count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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