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: Runtime Error

Solution code:
N,X=input().split()
n=int(N)
x=int(X)
i=list(map(int,input().split()))
D=0
k=0
while D<=x:
  D=D+i[k]
  k=k+1
if k<=n+1:
  print(k)
else:
  print(n+1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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


def main():
    n, x = map(int, input().split())
    ls = list(map(int, input().split()))
    count = 0
    d = 0

    for i in range(1, n + 2):
        if d > x:
            print(count)
            exit()

        d = d + ls[i - 1]
        count += 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

print(i)

Submission status: Runtime Error

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

sum = 0
count = 0

while sum <= x:
    sum += L[count]
    count += 1
    if count == n+1:
        break

print(count)

Submission status: Runtime Error

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

cnt = 0
total = 0
i = 0

while total <= X:
    cnt += 1
    total += L[i]
    i += 1

print(cnt)

Submission status: Runtime Error

Solution code:

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

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


curpos = 0
times = 1
while curpos <= x and times <= n+1:
    curpos += Ln[times-1]
    if curpos>x:
        break
    
    times += 1


print(times)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

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

bound = 1
pos = 0

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

print(bound)

Submission status: Runtime Error

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

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

def solve(now,ls,x,cnt):
    if now>x:
        return print(cnt)
    else:
        return solve(now+ls[cnt-1],ls,x,cnt+1)
solve(0,l,x,0)

Submission status: Runtime Error

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

ans = 0
d = 0
while(d <= x):
    d = d + l[ans]
    ans += 1
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
length = 0
i = 0
while x >= length:
    length += L[i]
    i += 1
print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

pos = 0
iter = 0

while pos <= X and len(L) >= iter:
    iter += 1
    pos += L[iter-1]
    

print(iter)

Submission status: Runtime Error

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

while step <= X and i <= N:
    step += L[i]
    i += 1

print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np


def solve():
    n, x = [int(i) for i in input().split()]
    l = np.array([int(i) for i in input().split()])

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

    if l[0] < x:
        ans += 1

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Runtime Error

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

cnt = 0
d = 0

while(x >= d):
  d += l[cnt]
  cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
N,X = [int(x) for x in input().split()]
data_jump = [int(x) for x in input().split()]
count = 1
sum_dis = 0
for i in range(N+1):
    sum_dis += data_jump[i]
    if sum_dis > X:
        break
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
N,X = map(int,input().split())
l = list(map(int,input().split()))
d = preD = 0
i = 0
while d <= X:
    d = preD + l[i]
    i += 1
    preD = d
print(i)

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())
li = list(map(int, input().split()))
i = 0
D = 0
while D <= X:
    D += li[i]
    i += 1
    if i > N + 1:
        break
if i > N + 1:
    print(N+1)
else:
    print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

sum_ = 0
tmp = []
for i in range(n):
    sum_ += l[i]
    if sum_ > x:
        tmp.append(i)
    elif sum_ == x:
        tmp.append(i + 2)

print(max(tmp))

Submission status: Runtime Error

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

d = 0
cnt = 0
for i in range(0, n):
  if i == 0:
    d = 0
  else:
    d = d + l
  if d <= x:
    cnt += 1
  if i != 0:
    l = int(input())

print (cnt)

Submission status: Runtime Error

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

cnt = 0
di = 0
while di <= x:
  cnt += 1
  di += l[cnt-1]

print(cnt)

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
n=0
zahyo=0
i=0
hane=list(map(int,input().split()))
while zahyo<=a[1]:
    n=n+1
    zahyo=zahyo+hane[i]
    i=i+1
print(n)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

bounce = [0]

while bounce[-1] < x:
  bounce.append(bounce[len(bounce)-1] + ls[len(bounce)-1])

print(len(bounce))

Submission status: Runtime Error

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

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

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

print(i)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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


now = 0
i = 0
while True:
    if now > X:
        break
    now += L[i]
    i += 1

print(i)

Submission status: Runtime Error

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

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

print(i)

Submission status: Runtime Error

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

while Di<=X:
    result+=1
    Di+=L[result-1]
    
print(result)

Submission status: Runtime Error

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

i = 0
s = 0
while s<=X:
    s += List[i]
    i+=1
    
print(i)

Submission status: Runtime Error

Solution code:
info = map(int, input().split(' '))
N, X = info[0], info[1]
info = 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: Runtime Error

Solution code:
a = list(map(int, input().split()))
L = list(map(int, input().split()))
d = 0
ans = 0
while d<=a[1]:
    d += L[ans]
    ans += 1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

s=list(map(int,input().split()))
i=0
ans=0
l=0
while l<=x:
   l=l+s[i]
   ans+=1
   i+=1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X,A = (int(x) for x in input().split())
L = list(map(int,input().split()))
cnt = 0
idx = 0
ans = 0
while(ans <= A):
  ans += L[idx]
  idx += 1
  cnt += 1
  
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
x,n=map(int,input().split())
l=input().split(" ")
c=0
ans=0
for i in range(n):
    t=int(l[i])
    c+=t
    ans+=1
    if(c>n):
        break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, X = map(int,input().split()) # 複数の数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

count = 0
point = 0

while point <= X:
    point += List[count]
    count += 1

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

count = 1
position = 0

while position <= X:
    position += L.pop(0)
    if position <= X:
        count += 1

print(count)

Submission status: Runtime Error

Solution code:
s = input().split()
N = int(s[0])
X = int(s[1])
ss = input().split()
L = []
for i in range(N):
    L.append(int(ss[i]))
    
D = 0
count =0
for i in range(N+1):
    D = D+L[i]
    count = count+1
    if D > X:
        break
        
print(count)

Submission status: Runtime Error

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

while D <= X:
  D += L[count]
  count += 1
  answer += 1

print(answer - 1)

Submission status: Runtime Error

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

while res <= x:
  res += li[index]
  index += 1

print(index)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

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

    cnt = 0
    D = 0
    while D <= X:
        D += A[cnt]
        cnt += 1

    return cnt


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

Submission status: Runtime Error

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

str = input()
L = []
for i in range(N) :
	L.append(int(str.split()[i]))

D = 0
i = 0
while(D <= X) :
	D = D + L[i]
	i = i + 1


print(i)

Submission status: Runtime Error

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

cnt = 0
D = 0
while D <= X:
    D += L[cnt]
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n,x = map(int, input().split())
L = list(map(int, input().split()))
ans = 0
loc = 0
i = 0
while loc <= x:
    loc += L[i]
    i += 1
print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
#入力取得
N, X = map(int, input().split())
l = tuple(map(int,input().split()))


d = 0
ans = 0

for i in range(N+1):
    if d > X:
        break
    else:
        ans += 1
        d = d + l[i]
print(ans)

Submission status: Runtime Error

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

ans = 0
D = 0
while(D <= X):
    D += L[ans]
    ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
N, X = gets.split.map &:to_i
L = gets.split.map &:to_i

pos = 0
ans = 1
L.each{|l|
  pos += l
  break if pos > X
  ans += 1
}

p ans

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

d = 0
ans = 1
i = 0
while d <= x:
  d += llist[i]
  i += 1
  ans += 1
print(ans - 1)

Submission status: Runtime Error

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
while dis<=x:
    dis+=l[i]
    i+=1
    cnt+=1
print(cnt)

Submission status: Runtime Error

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

ans = 0
d = 0
while 1:
    if d > x:
        break
    d += l[ans]
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())
A = [int(a) for a in input().split()]
x = 0
c = 0
i = 0
while x <= X:
    c += 1
    x += A[i]
    i += 1
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

i = 0
total = 0
while total <= x:
    total += l[i]
    i += 1
print(i)