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

D = [0]
for i, l in enumerate(L):
    D.append(D[i] + l)

res = 0
for c in D:
    if c <= X:
        res += 1

print(res)

Submission status: Accepted

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

ans = 1
ct = 0
D = 0
while True:
    D += L[ct]
    if D <= X:
        ct += 1
        ans += 1
    else:
        break
    if ct > N - 1:
        break

print(ans)

Submission status: Accepted

Solution code:
def abc():
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    cnt = 1
    pre = 0
    for _l in l:
        tmp = pre + _l
        if tmp > x:
            break
        pre = tmp
        cnt += 1
    print(cnt)


abc()

Submission status: Accepted

Solution code:
# using main() makes code faster from the point of view of "access to variables in global name-space"
# def main():

# for i, a in enumerate(iterable)
# q, mod = divmod(a, b)
# divmod(x, y) returns the tuple (x//y, x%y)
# manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
import sys
sys.setrecursionlimit(10**7)
from itertools import combinations, permutations # https://docs.python.org/ja/3/library/itertools.html
from math import factorial
def combinations_count(n, r):
    # faster than the following code
    # def combinations_count(n, r):
    #     return factorial(n) // (factorial(n - r) * factorial(r))
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result
def combination_with_repetition_count(n, r):
    return combinations_count(n + r - 1, r)
from collections import deque, Counter # https://docs.python.org/ja/3/library/collections.html#collections.deque
from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
from operator import itemgetter # ex: List.sort(key=itemgetter(1))
from functools import reduce
from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
def gcds(numbers):
    return reduce(gcd, numbers)
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcms(numbers):
    return reduce(lcm, numbers, 1)

# first create factorial_list
# fac_list = mod_factorial_list(n)
INF = 10 ** 18
MOD = 10 ** 6 + 3
modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
def modinv(a, p = MOD):
    # evaluate reciprocal using Fermat's little theorem:
    # a**(p-1) is identical to 1 (mod p) when a and p is coprime
    return modpow(a, p-2, p)
def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t
def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l
def modcomb(n, k, fac_list = [], p = MOD):
    # fac_list = modfactorial_list(100)
    # print(modcomb(100, 5, modfactorial_list(100)))
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
def modadd(a, b, p = MOD):
    return (a + b) % MOD
def modsub(a, b, p = MOD):
    return (a - b) % p
def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p
def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p))


# initialize variables and set inputs
#initialize variables
    # to initialize list, use [0] * n
    # to initialize two dimentional array, use [[0] * N for _ in range(N)]
# set inputs
    # open(0).read() is a convenient method:
    # ex) n, m, *x = map(int, open(0).read().split())
    #     min(x[::2]) - max(x[1::2])
    # ex2) *x, = map(int, open(0).read().split())
    #     don't forget to add comma after *x if only one variable is used
# calculate and output
    # output pattern
    # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6

# set test data
# sys.stdin = open('sample.txt') # for test

# functions used
r = lambda: sys.stdin.readline().strip() #single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: map(int, r().split())
# set inputs

n, x = R()
L = R()
tmp, count = 0, 0
for l in L:
    tmp += l
    count += 1
    if tmp > x:
        print(count)
        exit()
print(n+1)

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

Submission status: Accepted

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

#ls = [sum(Ls[:i+1]) for i in range(N)]
D = 0
out = 0
end = False
for L in Ls:
    out += 1 
    D = D + L
    if D > X:
        end = True
        break

if end == False:
    out += 1

print(out)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,x = na()
L = na()
ans = 0
a = 0

for i in L:
    ans+=1
    a+=i
    if a > x:
        break
    if ans == n:
        ans+=1

print(ans)

Submission status: Accepted

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: Accepted

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

D = 0
counter = 1
for L in L_list:
    D += L
    if D <= x:
        counter += 1
    else:
        break

print(counter)

Submission status: Accepted

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

bound = 1
a = 0
for i in range(len(d)):
  a += d[i]
  if a > X:
    break
  bound += 1
  
print(bound)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

d1=0
l_d = [d1]
for i in range(N):
    l_d.append(l_d[i]+l_l[i])
    
arr_d = np.array(l_d)
print(len(arr_d[arr_d<=X]))

Submission status: Accepted

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):
    pos += l[i]
    if pos > x:
        break
    bound += 1

print(bound)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N, X] = string_to_int(inputs[0])
    L = string_to_int(inputs[1])

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

        if step <= X:
            count += 1
        else:
            break
    return count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

Submission status: Accepted

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

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

ans = 1
c = 0

for i in range(n):
  if c+d[i] <= x:
    ans += 1
    c += d[i]
  else:
    print(ans)
    exit()

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
count=1
pos=0
for i in l:
    pos+=i
    if pos>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
count = 1
for i in l:
    if d + i <= x:
        count += 1
        d += i
    else:
        break
print(count)

Submission status: Accepted

Solution code:
x, y = list(map(int, input().split()))
bola = 0
bola1 = 0
quick = 1

l1 = input().split()

for c in range(x):
    bola1 = int(l1[c])

    bola += bola1

    if bola <= y:
        quick += 1

print(quick)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
##!/usr/bin/env python3
import sys
# from operator import itemgetter
# gcd
# from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
# from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
# import math
# from functools import reduce
#
# # input関係の定義
# fin = open('in_2.txt', 'r')
# sys.stdin = fin
# # 提出時はコメントアウト+上のshebangを有効にする
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':

    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]"

    # write code
    tmp = 1
    D = 0
    i = 0
    if sum(L) <= X:
        print(N + 1)
        sys.exit()
    while True:
        D += L[i]
        i += 1
        tmp += 1
        if D > X:
            break
    print(tmp-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

D = 0
Ds = [0]
for i in Ls:
    # print(i)
    res = D + i
    Ds.append(res)
    D = res

res_list = [i for i in Ds if i <= X]
# print(Ds)
# print(res_list)
print(len(res_list))

Submission status: Accepted

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

Submission status: Accepted

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

for i in l:
    ans += 1 if d <= x else 0
    d += i
print(ans)

Submission status: Accepted

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

S = 0
C = 0
for i in range(len(L)):
    S += L[i]
    if S <= X:
        C += 1

print C+1

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 += L[i]
    if D > 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()))
D=0
i=0
for i in range(N):
    D=D+L[i]
    if D<=X:
        i=i+1
        continue
    else:
        break
print(i+1)

Submission status: Accepted

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

Submission status: Accepted

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

tmp = 0
p = [0]
for e in l:
    p.append(e + tmp)
    tmp += e
    
count = 0
for e in p:
    if x >= e:
        count += 1

print(count)

Submission status: Accepted

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

D = 0
ans = 1
for l in L:
    D += l
    if D > X:
        break
    ans += 1

print(ans)

Submission status: Accepted

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


def solve(N: int, X: int, L: "List[int]"):
    d = 0
    ret = 1
    for l in L:
        d += l
        if d <= X:
            ret += 1
    print(ret)
    return


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:
s = input().split()
N = int(s[0])
X = int(s[1])
ss = input().split()
L = [0]*(N+1)
for i in range(N):
    L[i] = int(ss[i])
    
D = 0
count =0
for i in range(N+1):
    D = D+L[i]
    count = count+1
   # print(D)
    if D > X:
        break
        
print(count)

Submission status: Accepted

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

    print(solve(x, l))
    
def solve(x, l):
    pos = 0
    c = 0
    if x >= 0:
        c += 1
    
    for li in l:
        pos += li
        if pos <= x:
            c += 1

    return c

main()

Submission status: Accepted

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

D = 0
cost = 1
for i in range(N):
    D = D + L[i]
    if D > X:
        break
    cost += 1

print(cost)

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

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

al = [0,l[0]]
for i in range(len(l)-1):
    if i == 0:
        an = l[i] + l[i+1]
    else:
        an += l[i+1]
    al.append(an)

count = 0
for k in al:
    if k <= x:
        count += 1
            
print(count)

Submission status: Accepted

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

count = 1
cur = 0
while len(ls) > 0:
    cur += ls.pop()
    if cur <= x:
        count += 1
    else:
        break

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

counter = 1

D =0

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

print(counter)

Submission status: Accepted

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

num = 0
for i in range(len(L)):
    num += L[i]
    if num > X:
        print(i+1)
        break

if num <= X:
    print(len(L)+1)

Submission status: Accepted

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

#l[0]: 2回目
cnt = n+1
for i in range(1, n):   #i+1回目の判断 できないならi
    l[i] += l[i-1]
    if l[i] > x:
        cnt = i+1   # i kai madedekita
        break
if l[0] > x:
    cnt = 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

count=1
for j in range(n):
    if d_list[j]<=x:
        count+=1
print(count)

Submission status: Accepted

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

point=0
count=1
for i in li:
  point += i
  if point<=X:
    count+=1
print(count)

Submission status: Accepted

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

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

ans = 1

sum_L = 0


for i in range(N):
	sum_L += L[i]
	if(sum_L > X):
		break;
	else:
		ans += 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, X = map(int,input().split())
lLst = list(map(int, input().split()))
D = 0
ansLst = []
ansLst.append(D)
tmp1 = 0
for i in range(N):
    tmp = tmp1 + lLst[i]
    if tmp <= X:
        ansLst.append(tmp)
        tmp1 = tmp
    else:
        break

print(len(ansLst))

Submission status: Accepted

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

ans = [0]
for i in range(n):
    ans.append(ans[i]+l[i])
count = 0
for i in ans:
    if i <= x:
        count += 1
print(count)

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
#from collections import deque, defaultdict, Counter
#from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
#from itertools import permutations, combinations, product
#from operator import itemgetter, mul
from copy import deepcopy,copy
#from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd


def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, x = MAP()

lis = MAP()

d = 0
ct = 1

for y in lis:
    d += y
    if d > x:
        print(ct)
        break
    else:
        ct += 1
else:
    print(n+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n, x = map(int, input().split())
l = list(map(int, input().split()))
t = 0
cnt = 1
for i in range(n):
    t += l[i]
    if t <= x:
        cnt += 1
    else:
        break
print(cnt)

Submission status: Accepted

Solution code:
N, X = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
L = 0
count = 0
flag = 0
for i in a:
    L += i
    count += 1
    if L > X:
        print(count)
        flag = 1
        break
if flag == 0:
    print(count+1)

Submission status: Accepted

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

Submission status: Accepted

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

NX = input().split(' ')
N = int(NX[0])
X = int(NX[1])
L = map(int, input().split(' '))

LL = list()
LL.append(0)
n = 0
for l in L:
    n += l
    LL.append(n)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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

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

count = 1
pos = 0
for i in Llist:
    pos += i
    if pos > X:
        print(count)
        break
    count += 1

if count == N+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):
    if d+L[i] <=x:
        cnt+=1
        d=d+L[i]
    else:
        break

print(cnt)

Submission status: Accepted

Solution code:
import numpy as np

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

candidate_list = np.cumsum(L_list)
print(sum(candidate_list <= X) + 1)

Submission status: Accepted

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

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

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:
        print(ans)
        exit()
    ans += 1
    d += int(L[i])
if d <= X:
    ans += 1
print(ans)

Submission status: Accepted

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

for i in range(n+1):
    if cum[i] <= x:
        counter += 1
    else:
        break
print(counter)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n,x=map(int,input().split())
lst=map(int,input().split())
_lst=[0]
for l in lst:
    _lst.append(_lst[-1]+l)
#print(_lst)
num=0
for l in _lst:
    if l<=x:
        num+=1
    else:
        break
print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

d = 0
jumps = [0]
for i in range(len(L)):
    d = d + L[i]
    jumps.append(d)
    
cnt = 0
for x in jumps:
    if x <= X:
        cnt += 1
    else:
        pass
    
print(cnt)

Submission status: Accepted

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

s=list(map(int,input().split()))
i=0
ans=0
l=0
while l<=x:
    try:

       l=l+s[i]
       ans+=1
       i+=1
    except:
        ans+=1
        break
print(ans)

Submission status: Accepted

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

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

bond = [0]
last = 0

for i in range(n):
    last = l[i] + last
    bond.append(last)

#print(bond)

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

print(count)

#print(l)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 16 20:56:28 2019

@author: Yamazaki Kenichi
"""

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

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

print(i+1)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
p = 0
for i in range(len(li)):
    p += li[i]
    if p > x:
        break
    else:
        cnt += 1

print(cnt)

Submission status: Accepted

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

cnt = 0
ans = 1
for i in L:
	cnt += i
	if X >= cnt:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:
import bisect

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

D = [0] * (N + 1)

for i in range(N):
    D[i + 1] = D[i] + L[i]
    
print(bisect.bisect_right(D, X))

Submission status: Accepted

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

for i in range(1, n+1):
    bounds.append(bounds[i-1] + ls[i-1])

#print(bounds)

for i in range(len(bounds)):
    if bounds[i] <= x:
        count += 1
    else:
        break

print(count)

Submission status: Accepted

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

x = 0
score = 1
for i in L:
    x += i
    if x <= X:
        score += 1


print(score)

Submission status: Accepted

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

count = 0
prev = 0
now = 0
for l in ls:
    now = prev + l
    if now <= x:
        count += 1
    else:
        break
    prev += l

print(count + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = list(map(int, input().split()))
j = list(map(int, input().split()))

N = i[0]
X = i[1]

d = 0
bound = 0

for L in j:
    d = d + L
    if d <= X:
        bound+=1
print(bound+1)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
llist = list(map(int,input().split()))
ans = 1
now = 0
for i in llist:
    now += i
    if now <= x:
        ans += 1
print(ans)

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

print(cnt)