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:
# coding: utf-8

bound, check = map(int,input().split())

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

now = 0
if now <= check:
    count = 1
else :
    count = 0
for i in range(bound):
    now += l[i]
    if now <= check:
        count += 1

print(count)

Submission status: Accepted

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

print( sum( [sum(L[:l]) <= X for l in range(len(L)+1)] ) )

Submission status: Accepted

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

D = 0
for i, L in enumerate(L_list):
  D += int(L)
  if D >= int(X):
    break

if D > int(X):
  print(i + 1)
else:
  print(i + 2)

Submission status: Accepted

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

Submission status: Accepted

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

current = 0
res = 0

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

if current <= x:
  res += 1

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

d = 0
for idx, l in enumerate(Ls):
    d += l
    if d > X:
        print(idx+1)
        exit()

print(N+1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

s = list(map(int,input().split()))
N = s[0]
X = s[1]

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

counter = 1
coordinate = 0


for i in range(N):
    coordinate += L[i] #次に跳ねる座標
    if coordinate > X:
         break
    counter += 1


print(counter)

Submission status: Accepted

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

cnt = 0
now = 0
for i in range(n):
	now += int(l[cnt])
	if now > x:
		break
	else:
		cnt += 1

print(cnt+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = list(map(int, input().split()))
num_list = list(map(int, input().split()))
count = 1
place = 0
for i in range(num[0]):
    place = place + num_list[i]
    if place <= num[1]:
        count+=1
print(count)

Submission status: Accepted

Solution code:
X = input().split()
Y = input().split()

D = 0
Da = 0
count = 1
for i in range(int(X[0])):
    D = Da + int(Y[i])
    if D > int(X[1]):
        break
    Da = D
    count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

def count_bound(L):
	s=0
	count = 0
	for l in L:
		if(s<=X):
			count+=1
		s+=l
	if(s<=X):
		count+=1
	return count

print(count_bound(L))

Submission status: Accepted

Solution code:
input_line = input().split()

N = int(input_line[0])
X = int(input_line[1])

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

resultArray = []

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

result = [n for n in resultArray if n <= X]

print(len(result))

Submission status: Accepted

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

pos, jumps, count = 0, 0, 1
while jumps < n:
    pos += nums[jumps]
    if pos <= x:
        count += 1
    jumps += 1    

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 1
d = 0
for i in range(n):
    d += Ls[i]
    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()))
d = 0
count = 0
flg = True
for lx in l:
    if d <= x:
        count += 1
        d = d + lx
    else:
        flg = False
        break
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] * (len(l) + 1)
sum = 0

for i in range(len(l) + 1):
    if i == 1:
        d[i] = l[i - 1]
    elif i == 0:
        pass
    else:
        d[i] = d[i - 1] + l[i - 1]

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

print(sum)

Submission status: Accepted

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

count=0
ans=1

for i in list:
  count += i
  if count > X:
    print(ans)
    exit()
  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)

tmp = 0
count = 0
for i in range(n+1):
    if i != n:
        tmp += L[i]
        if x < tmp:
            print(count)
            break
        count += 1

    else:
        tmp += L[i]
        if x >= tmp:
            count += 1
        print(count)

Submission status: Accepted

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

Ls = []
Ls.append(input().split())
# print(Ls)

Zahyo = [0]
for i in range(N) :
    Zahyo.append(int(Zahyo[i])+int(Ls[0][i]))
# print(Zahyo)

ans = []
for j in range(N+1) :
    if int(Zahyo[j]) <= X :
        ans.append("0")
print(len(ans))

Submission status: Accepted

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


print(i)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=[int(_) for _ in input().split()]
count=1
x=0
for n in range(N):
    x+=L[n]
    if x<=X:
        count+=1
print(count)

Submission status: Accepted

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

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

cnt = 1
length = 0

for l in ls:
    length += l
    if length  <= x:
        cnt += 1
    else:
        break

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

l = [int(s) for s in input().split()]
d = 0
i = 1
d = [0] * (n+1)
count = 0
if n == 1 and x >= l[0]:
    print(1)
elif n == 1 and x < l[0] :
    print(0)
else:

    while True:
        
        
        d[i] = d[i-1] + l[i-1]
        count += 1
        
        if d[i] > x:
            break
        
        i += 1
        if i > n:
            print(count+1)
            exit()

    print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

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

l = deque(list(map(int,input().split())))
count = 0

if sum(l) <= x:
    print(n+1)
else:
    while count <= x:
        count += l.popleft()
        if len(l) == 0:
            break

    print(n-len(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = (int(i) for i in input().split()) 
l_ls = [int(i) for i in input().split()]
cnt = 1
d = 0
for one_l in l_ls:
	d += one_l
	if d > x: break
	cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) 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 MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, x = MI()
l = LI()
cnt = 0
ans = []
ans.append(0)
z = 0
for i in range(n):
    z += l[i]
    ans.append(z)
for num in ans:
    if num <= x:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate
N, X = map(int, input().split())
L = [int(i) for i in input().split()]
ans = 0
l = [0] + list(accumulate(L))
for x in l:
    if x <= X:
        ans += 1
    else:
        break
print(ans)

Submission status: Accepted

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

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

d = 0
counter = 1

for i in range(0, n):
  d = d + ls[i]
  if x>=d:
    counter += 1

print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
blist = input().split()
i = 0
b = 0
while i < n:
  b += int(blist[i])
  if b > x:
    print(i + 1)
    break
  else:
    if i == n - 1:
      print(n + 1)
      i += 1
    else:
      i += 1

Submission status: Accepted

Solution code:
a = input().split(" ")
l = input().split(" ")
x = int(a[1])
y = 0
num = 1
for i in l:
    y += int(i)
    if y <= x:
        num += 1
    else:
        break
print(num)

Submission status: Accepted

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

D = 0
count = 1
for step in steps:
    D += step
    if D <= X:
        count += 1
    else:
        break

print(count)

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

print(len(l2))

Submission status: Accepted

Solution code:
#最初に入れておくとinputが早くなる
import sys
input = sys.stdin.readline

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

for i in range(1,n):
    l[i]=l[i-1]+l[i]

#print(l)
t=0
for _ in l:
    if (l[t] > x):
        break
    t+=1

print(t+1)

Submission status: Accepted

Solution code:
import sys

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

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

    res = 0
    sum = 0
    for l in llist:
        if (sum + l) <= x:
            res += 1
            sum += l
        else:
            break
    
    print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC130B-Bounding.py

import sys
from functools import lru_cache

def main():
    N, X = list(map(int,sys.stdin.readline().split()))
    L = list(map(int,sys.stdin.readline().split()))

    @lru_cache(maxsize=None)
    def D(i):
        if i == 1:
            return 0
        elif i <= N+1:
            return D(i-1) + L[i-2]

    for i in range(1,N+2):
        if D(i) > X:
            print(i-1)
            break
    else:
        print(N+1)



if __name__ == "__main__":
    main()

Submission status: Accepted

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

wa = 0
count = 1
for i in range(n):
  wa += ls[i]
  if wa > x:
    break
  count += 1
print(count)

Submission status: Accepted

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

print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, X: int, L: "List[int]"):
    ds = [0] + list(accumulate(L))
    return len([d for d in ds if d <= X])


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]"
    result = solve(N, X, L)
    if isinstance(result, Iterable) and not isinstance(result, str):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
flag = 0

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

if flag == 0:
    print(n+1)

Submission status: Accepted

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

Submission status: Accepted

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


ans = 1
D = 0
for i in range(N):
    if D + positions[i] <= X:
        D += positions[i]
        ans += 1
    else:
        print(ans)
        exit()
print(ans)

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
out=0
c=1
for i in range(a[0]):
  out=out+b[i]
  if a[1]>=out:
    c=c+1

print(c)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 1
num = 0

for i in range(l):
	num += int(S[i])
	if num <= X:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
#n = int(input()) 
n,x = (int(i) for i in input().split())
l= [int(i) for i in input().split()]

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

Submission status: Accepted

Solution code:
n,x = (int(i) for i in 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)
        exit(0)
print(n+1)

Submission status: Accepted

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

total = 0
for i, l in enumerate(L):
    total += l
    if total > X:
        break
else:
    i += 1
print(i + 1)

Submission status: Accepted

Solution code:
N, X = map(int, raw_input().split())
sum = 0
L = map(int, raw_input().split())
count = 1

for l in L:
    sum += l
    if 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()))
D=0
B=0
i=0
while D<=X and i<=N-1:
    D=D+L[i]
    B=B+1
    i=i+1
if i==N and D<=X:
    B=B+1
print(B)

Submission status: Accepted

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

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

tmp = 0
li = []
for i in range(n):
    tmp += l[i]
    if tmp <= x:
        li.append(i)
    if tmp >= x:
        break

print(max(li) + 2)
# if tmp == x:
#     print(max(li) + 2)
# elif tmp > x:
#     print(max(li) + 1)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
inputs = [int(s) for s in input().split()]
n = inputs[0]
x = inputs[1]
l = [int(s) for s in input().split()]
d = 0
count = 1
for i in range(n):
    d = d + l[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()))
result = 0
for i in range(len(L)):
    result = result + L[i]
    if result > X:
        print(i+1)
        break
else:
    print(len(L)+1)

Submission status: Accepted

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

Submission status: Accepted

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

for i in li:
  res += i
  if res > x:
    break

  cnt += 1

print(cnt)

Submission status: Accepted

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

arr =[ 0 for _ in range(n+1)]
arr[1:] = [int(i) for i in input().split()]
for i in range(1,n+1):
	arr[i]+=arr[i-1]


su=0
for i in range(n+1):
	if ( arr[i] <= x):
		su+=1
print(su)

Submission status: Accepted

Solution code:
a=input().split()
N,X=int(a[0]),int(a[1])
b=input().split()
l=[None]*N
x=0
c=1
for i in range(N):
    x+=int(b[i])
    if x>X:
        break
    c+=1
print(c)

Submission status: Accepted

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

ans = 1
s = 0

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

Submission status: Accepted

Solution code:
bound_num, line_length = map(int, input().split())
l = list(map(int, input().split()))

bound = 1
length_sum = 0
for i in range(bound_num + 1):
    if(i == bound_num):
        print(len(l)+1)
        exit()
    if(length_sum + l[i] <= line_length):
        bound += 1
    else:
        print(bound)
        exit()
    length_sum += l[i]

Submission status: Accepted

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

count = 0
position = 0
for i in range(N):
    if X<position:
        break
    else:
        count += 1
        position += Ls[i]

if X<position:
    pass
else:
    count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

# s = input()
# n = int(input())
# A = list(map(int, input().split()))
N, X = map(int, input().split())
L = list(map(int, input().split()))

res = 1
D = 0

for l in L:
    D += l
    if D <= X:
        res += 1

print(res)

Submission status: Accepted

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

for j in range(len(L)):
    line += L[j]
    if line <= X:
        cnt += 1 

print(cnt)

Submission status: Accepted

Solution code:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,x=IL()
L=IL()
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())
*L, = map(int, input().split())

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

num = 0
i = 0
d = D[i]
while d <= X and num < N+1:
    num += 1
    i += 1
    if i != N+1:
        d = D[i]

print(num)

Submission status: Accepted

Solution code:
N, X = (int(x) for x in 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: count +=1
    
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

cnt = 0

def main():
    N, X = map(int, input().split())
    L = [int(e) for e in input().split()]

    def rec(i, d):
        global cnt
        if d > X:
            return
        cnt += 1
        if i >= N:
            return
        return rec(i+1, d + L[i])

    rec(0, 0)
    print(cnt)


main()

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
li=map(int,input().split())
num = 0
cnt = 0
for i in li:
  num += i
  cnt += 1
  if num > x:
    print(cnt)
    break
  elif cnt == n:
    print(n+1)
    break
  else:
    pass

Submission status: Accepted

Solution code:
nx = input().split()
n = int(nx[0])
x = int(nx[1])
l = input().split()
l = [int(l[i]) for i in range(n)]
haneru = [0]
for i in range(n):
  tmp = haneru[i] + l[i]
  haneru.append(tmp)

tmp = 1
for i in range(len(haneru)):
  if haneru[i] > x:
    break
  else:
    tmp = i
print(tmp+1)

Submission status: Accepted

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

ans = 0
count_n = 1
for n in range(N):
    ans += L[n]
    count_n += 1
    if ans > X:
        print(count_n - 1)
        exit()
print(count_n)

Submission status: Accepted

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

L = inb.split()

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

i = 0
for j in (sums):
  if j <= X:
    i += 1
print(i)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
d = 0

while(True):
  if cnt - 1 == n:
    break
  d += l[cnt - 1]
  if d > x:
    break
  cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N, X = map(int,input().split())
lm = list(map(int,input().split()))
ln = [0]
for x in range(1,len(lm)+1):
    ln.append(ln[x-1]+lm[x-1])
s = 0
for x in range(len(ln)):
    if ln[x] <= X:
        s += 1
    else:
        break
print('{}'.format(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate
n,x=map(int,input().split())
L=list(map(int,input().split()))
Acc=[0]+list(accumulate(L))
ans=0
for a in Acc:
    if a<=x:
        ans+=1
print(ans)

Submission status: Accepted

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

cnt = 1 if 0 <= X else 0
y = 0
for i in L:
    y += i
    cnt+= 1 if y<=X else 0

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

lis = list(map(int,input().split()))
count = 1
sm = 0
for l in lis:
  sm += l
  if sm > X:
    break
  count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
a = 0
ans = 1
for i in range(N):
    a += L[i]
    if a <= 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):
    D += L[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()]
now = 0
ans = 1
for i in range(N):
  now += L[i]
  if now <= X: ans += 1
  else: break
print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
num = 0
count = 0
listA=list(map(int,input().split()))
    #listA<-[1,2,2,3,1]
    #ここに逐次処理を書けばいいと思う。

for i in range(N+1):
    if num<=X and i==N:
        count=i+1
        break
    elif num<=X:
        num = num+listA[i]
        count=count+1
    else:
        break
print(count)

Submission status: Accepted

Solution code:
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
ruiseki.insert(0,0)
i = 0
#print(ruiseki)
while i < len(ruiseki) and ruiseki[i] <= x:
    i += 1
print(i)

Submission status: Accepted

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

d=0
cnt=0
for i in range(n):
    if d>x :
        print(cnt) 
        sys.exit()   
    else:
        d+=l[i]
        cnt+=1

if d>x:
    print(cnt)
else:
    print(n+1)

Submission status: Accepted

Solution code:
a,b = list(map(int,input().split()))
d = list(map(int,input().split()))
c = 0
count = 1
for i in range(a):
    c += d[i]
    if c <= b:
        count += 1
print(count)

Submission status: Accepted

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

i, c = 0, 1

for x in L:
    i = i + int(x)
    if i <= X:
        c = c + 1

print(c)

Submission status: Accepted

Solution code:
# N, X = map(int, input().split())
#
# LLL = list(map(int, input().split()))  # 長さN
#
# d = [0]
# for i in range(len(LLL)):
#     d.append(d[-1]+LLL[i])
#
# hoge = 0
# for i in range(1, len(d)):
#     if X >= d[i]:
#         hoge += 1
#     else:
#         print(hoge)
#         exit()

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

LLL = list(map(int, input().split()))  # 長さN

d = [0]
for i in range(len(LLL)):
    d.append(d[-1]+LLL[i])

for i in range(1, len(d)):
    if d[i] > X:
        print(i)
        exit()

print(N+1)

Submission status: Accepted

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

print(count)

Submission status: Accepted

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