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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
r = 0
for l in L:
    r += l
    if x < r:
        print (ans)
        exit ()
    else:
        ans += 1
print (ans)

Submission status: Accepted

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

import sys

input = iter(sys.stdin.read().splitlines()).__next__

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

P = [0]
for d in L:
   P.append(P[-1] + d)

res = len( [1 for x in P if x <= X] )
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

print(len(Length))

Submission status: Accepted

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

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

f = True
for i in range(n+1):
    if cum[i] > x:
        f = False
        print(i)
        break
if f:
    print(n+1)

Submission status: Accepted

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

pre_coordinate = 0
ans = 1

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

print(ans)

Submission status: Accepted

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

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:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n,x=n1()
L=n1()
ans=1
c=0
for i in L:
    c+=i
    if c>x:
        break
    ans+=1
print(ans)

Submission status: Accepted

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

cnt = 0
l = list()
for i in A:
    cnt += i
    l.append(cnt)

ans = 0
for c in l:
    if c <= X:
        ans += 1
print(ans + 1)

Submission status: Accepted

Solution code:
def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split()))

n,x = intMap()
l = intList()

ans = 1
d = 0

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

print(ans)

Submission status: Accepted

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

dis=0

for i in range(n):
    dis += l[i]
    if dis > x:
        print(i+1)
        exit(0)
    else:
        pass
print(n+1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import numpy as np


def main():
    N, X = map(int, input().split())
    L_list = list(map(int, input().split()))
    L_sum = np.cumsum(L_list)
    print(np.where(L_sum <= X)[0][-1] + 2)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
cnt=1
x=0

for l in list(map(int,input().split())):
    x+=l
    if x>X: break
    cnt+=1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[0]
for i in range(N):
    D.append(D[i]+L[i])
print(bisect.bisect_right(D,X))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from sys import stdin

n, x = map(int, stdin.readline().split())
count = 1
num = 0
num_list = [0]

l = list(map(int, stdin.readline().split()))

for i in l:
  num += i
  num_list.append(num)
  if(num > x):
    print(count)
    sys.exit()
  else:
    count += 1 

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

ans = [i <= x for i in d]
print(sum(ans))

Submission status: Accepted

Solution code:
n, x = [int(x) for x in input().split()]
k = 0
ans = 1
for li in input().split():
    k += int(li)
    ans += k <= x

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

a=0
for j in range(N+1):
    if D[j] <= X:
        a=a+1
    else:
        pass

print(a)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
num = input().split()
cnt = 1
cal = 0
for x in range (N):
  cal += int(num[x])
  if cal <= 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 for _ in range(N + 1)]
for i in range(1, N + 1):
  D[i] = D[i-1] + L[i-1]
  count = 0
for i in range(N + 1):
  if D[i] <= X:
    count += 1
print(count)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
temp=[0]*(n+1)
for i in range(0,n):
  temp[i+1]=temp[i]+l[i]
import bisect
print(bisect.bisect_right(temp,x))

Submission status: Accepted

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

Submission status: Accepted

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

# check
cnt = 1
D = 0
for i in range(N):
    D = D + L[i]
    if D <= X:
        cnt += 1

print(cnt)

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(n):
    d += l[i]
    if d > x:
        print(cnt)
        exit()
    cnt += 1
print(n + 1)

Submission status: Accepted

Solution code:
z = list(map(int, input().split()))
l = list(map(int, input().split()))
count = 0
t = 0
for i in range(0, z[0]+1):
  if (i-1) >= 0:
    count += l[i-1]
  if count <= z[1]:
    t += 1
print(t)

Submission status: Accepted

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

d = [0]
total = 0
for i in range(n):
  total += l[i]
  d.append(total)

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

Submission status: Accepted

Solution code:
import os

def main():
    n,x = map(int, input().split())
    list_a = list(map(int, input().split()))
    ans = 0
    count = 1

    for i in range(n):
        ans += list_a[i]
        if (ans <= x):
            count += 1
        else:
            break

    print(count)

if __name__ == "__main__":
    main()

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.append(d[i]+l[i])
  if d[i+1]>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()))
mem=0; ans=1
for i in L:
    mem+=i
    if mem<=X: ans+=1
print(ans)

Submission status: Accepted

Solution code:
import bisect
n,x=map(int,input().split())
L=list(map(int,input().split()))
lst=[0]*(n+1)
for i in range(1, n+1):
  lst[i]=lst[i-1]+L[i-1]
print(bisect.bisect_right(lst,x))

Submission status: Accepted

Solution code:
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import numpy as np
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))


n,x=input_list()
a=input_list()
ans=1
n=0
for each in a:
    n=n+each
    if n<=x:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(int(i) for i in input().split())
s=[]
for i in range(len(l)+1):
  t=sum(l[:i])
  if t <= x:
    s.append(t)
print(len(s))

Submission status: Accepted

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

for L in Ls:
    D += L
    if D > 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
p = 1
for i in range(n):
    d = d + l[i]
    if d <= x:
        p += 1
    else:
        break
print(p)

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
import copy

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

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

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect

N, X = map(int, input().split())
L = list(map(int, input().split()))
DP = [0] * (N+2)
for i in range(2, N+2):
    DP[i] = DP[i-1] + L[i-2]

ans = bisect.bisect_right(DP, X)
print(ans-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

l=[int(x) for x in input().split()]
d=0
cnt=1
for i in l:
    d+=i
    cnt+=1
    if d > x:
        print(cnt-1)
        break
    elif d==x:
        print(cnt)
        break
if d<x:
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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.append(d[i]+l[i])
cnt=0
for dd in d:
  if dd>x:
    break
  cnt+=1
print(cnt)

Submission status: Accepted

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

for i in range(N+1):
    if sum(Llist[:i]) > X:
        print(i)
        exit()
else:
    print(i+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):
    if d > x:
        print(i)
        exit(0)
    d += l[i]
if d > x:
    print(n)
else:
    print(n + 1)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
import bisect
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def bit_count(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#############
# Main Code #
#############

N,X = inputIL()
L = inputIL()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))
    B = [0]
    for a in A:
        B.append(B[-1] + a)
    ans = 0
    for b in B:
        if b <= m:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from itertools import accumulate
from bisect import bisect

N, X = [int(n) for n in input().split()]
L = list(accumulate([0] + [int(n) for n in input().split()]))
print(bisect(L, X))

Submission status: Accepted

Solution code:
from itertools import accumulate
from bisect import bisect

N, X = [int(n) for n in input().split()]
L = accumulate([0] + [int(n) for n in input().split()])
l = [n for n in L]
print(bisect(l, X))

Submission status: Accepted

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

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

dis = 0
ans = 1
for i in range(n):
    dis += L[i]
    if dis > x:
        dis -= L[i]
        break
    ans += 1

print(ans)

Submission status: Accepted

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

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

l2 = [0]*(n+1)

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

Submission status: Accepted

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    n,x=L()
    l=L()
    ans=1
    d=0
    for i in range(n):
       d=d+l[i]
       if d<=x:
           ans+=1
    print(ans)
    

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
import sys
N,X = map(int,input().split())
l = list(map(int,input().split()))
for i in range(N-1):
  l[i+1] += l[i]
  
for i in range(N):
  if l[i] > X:
    print(i+1)
    sys.exit()
    
print(N+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 00:21:28 2020

@author: shinba
"""

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

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

i = 0
ans = 1

for j in range(n):
    i += L[j]
    if i <= x:
        ans += 1
        continue
    else:
        break

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N, X = map(int, input().split())
A = list(map(int, input().split()))
B = [0]
cnt = 0

for i in range(N):
  B.append(B[i]+A[i])

for i in range(len(B)):
  if B[i] <= X:
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
def bounding(n, x, lli):

    ans = 1
    count = 0

    for i in lli:
        count += i
        if count <= x:
            ans += 1

    return ans
def main():
    n, x = map(int, input().split())
    lli = list(map(int, input().split()))
    print(bounding(n, x, lli))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N, X = (int(x) for x in input().split())
    L = [int(x) for x in input().split()]
    D = [0]

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

    print(len(D))


if __name__ == "__main__":
    main()

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.append(bound[i]+l[i])
ans = sum(i<=x for i in bound)
print(ans)

Submission status: Accepted

Solution code:
import itertools
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
L = [0]+list(itertools.accumulate(L))
cnt = 0
for l in L:
    if X < l:
        print(cnt)
        exit()
    cnt += 1
print(cnt)

Submission status: Accepted

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

t = 0
cnt = 1

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

Submission status: Accepted

Solution code:
import bisect

N, X = map(int, input().split())
l = list(map(int, input().split()))
d = [-1]*(N+1) #0-index #バウンドする位置を格納するリスト
d[0] = 0 #バウンドする初期値は0

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

#print(d)
#print('left:', bisect.bisect_left(d, X))
#print('right:', bisect.bisect_right(d, X))
print(bisect.bisect_right(d, X))

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:
        cnt+=1
    else:
        print(cnt)
        exit(0)

print(cnt)

Submission status: Accepted

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

cnt = 0
for i, li in enumerate(l):
    cnt += li
    if cnt > x:
        print(i + 1)
        break
else:
    print(n + 1)

Submission status: Accepted

Solution code:
import bisect

N, X = map(int, input().split())
L = [0]+list(map(int, input().split()))

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

print(bisect.bisect_right(L, X))

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

Submission status: Accepted

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


solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n, x = Is()
L = LI()
A = [0]
for i in range(1, n+1):
    A.append(A[i-1]+L[i-1])
index = bisect_right(A, x)
print(index)

Submission status: Accepted

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

tmp = 0
ans = 1
for i in L:
    tmp += i
    if tmp<=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_i, count = 0,0
for l in L:
  D_i1 = D_i+ l
  #print(D_i1)
  if D_i1<=X: count+=1
  D_i = D_i1
print(count+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC130B

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

Submission status: Accepted

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

dist = 0

for i,d in enumerate(li,2):
  dist += d
  if dist > x:
    i -= 1
    break

print(i)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline

def main():
    N, X = map(int, readline().rstrip().split())
    L = list(map(int, readline().rstrip().split()))
    ans = 1
    d = 0
    for l in L:
        d += l
        if d <= X:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# B - Bounding

N, X = map(int, input().split())
L = [int(l) for l in 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 = map(int,input().split())
L = list(map(int,input().split()))
ans = 1

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

Submission status: Accepted

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

bound = 1
d = 0
for l in L:
    if d + l > X:
        break
    else:
        bound += 1
        d += l
print(bound)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0] * (n+1)
d[0] = 0
for i in range(1,n+1):
    d[i] = d[i-1] + l[i-1]
print(len([i for i in d if i <= x]))

Submission status: Accepted

Solution code:
from bisect import bisect_left


n, x = map(int, input().split())
l = list(map(int, input().split()))
for i in range(n - 1):
  l[i + 1] += l[i]
print(bisect_left(l, x + 1) + 1)

Submission status: Accepted

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

position=0
cnt=1

for i in range(N):
    position+=Llist[i]
    if position <= X:
        cnt+=1

print(cnt)

Submission status: Accepted

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

D = [0]*(N+1)
for i in range(1,N+1,1):
    D[i] = D[i-1] + L_li[i-1]
print(len([i for i in D if i <= X]))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    pos = 0
    for i in range(1,N+1):
        pos = pos + L[i-1]
        if pos > X:
            print(i)
            break
    else:
        print(N+1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
sys.setrecursionlimit(10**6)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion

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

Submission status: Accepted

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

Submission status: Accepted

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

zahyou=[0]
for i in range(n):
    zahyou.append(zahyou[i]+l[i])
for i in range(len(zahyou)):
    if zahyou[i]>x:
        del zahyou[i:n+1]
        break
print(len(zahyou))

Submission status: Accepted

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