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())
suu = [int(i) for i in input().split()]
flop,flag =0,1 

for i in range(N):
    flop += suu[i]
    if flop <= X:
        flag += 1

print(flag)

Submission status: Accepted

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

D=0
i=0
c=0
while D <= X:
    try:
        c+=1
        # if i>len(l):
        #     break
        D+=l[i]
        i+=1
    except IndexError:
        break

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#print(nums)

s=0
cnt=1
ans=[]
for i in nums:
    s=s+i
    ans.append(s)

for i in ans:
    if i<=x:
        cnt+=1

print(cnt)

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(1,len(L)+1):
    dd=d[i-1]+L[i-1]
    d.append(dd)
num=0
for j in range(len(d)):
    if d[j]<=x:
        num+=1
print (num)

Submission status: Accepted

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

count = 1
d = [0] * (N+1)
for i in range(1, N+1):
    d[i] = d[i-1] + L[i-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()))

cnt = 0
before = 0
d = 0
L.insert(0, 0)

#d_recode = []

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

    if d <= X:
        cnt += 1

    #d_recode.append(d)
    before = d

#print(d_recode)
print(cnt)

Submission status: Accepted

Solution code:

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



cnt = 0
x = 0
for length in L:
    #print(cnt, x)
    if x <= X:
        cnt += 1
        x += length
    else:
        break
else:
    if x <= X:
        cnt += 1


print(cnt)

Submission status: Accepted

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

d=[0]*(X+1)

for i in range(1,X+1):
    d[i] = li[i-1] + d[i-1]

count = 0

for i in range (0,X+1):
    if d[i] <= A:
      count = count + 1 
    
print(count)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    bound = bound + 1
    while bound_x + l_list[index] <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
        if index >= len(l_list):
            break

    print(bound)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = raw_input().split(" ")
n,x = map(lambda s: int(s), i)
lst = raw_input().split(" ")

ans = 0
count = 1
for  s in lst:
    ans += int(s)
    if ans > x:
        break
    else:
        count += 1


print(count)

Submission status: Accepted

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

cnt = 1
snum = 0
for num in L:
    snum += num
    if snum <= X:
        cnt += 1
    else:
        break
print(cnt)

Submission status: Accepted

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

D = [0 for _ in range(n + 1)]

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

res = [True if D[i] <= x else False for i in range(n + 1)]

print(sum(res))

Submission status: Accepted

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

cnt = 0
D = 0
while D <= X and cnt < len(L):
    D += L[cnt]
    cnt += 1

if D <= X:
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n, x = input().split()
L = input().split()
for i, l in enumerate(L):
  if i == 0:
    D = int(l)
  else:
    D = int(l) + D

    
  if D > int(x):
    print(i + 1)
    break
    
if D <= int(x):
  print(int(n) + 1)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

count = 1

current = 0

for l in l_list:
    current += l
    count += 1
    if current > x:
        break

if current > x:
    print(count - 1)
else:
    print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N,X = map(int,input().split())
L = list(map(int,input().split()))
La = np.array(L)
Lcs = La.cumsum()
b_count = 1
for l in Lcs:  
  if X < l:
    break
  b_count += 1
print(b_count)

Submission status: Accepted

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

Submission status: Accepted

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

length = 0;
answer = 1;
i = 0;

while length + l[i] <= n[1]:
    length = length + l[i]
    answer = answer + 1
    if(len(l) == (i+1)):
        break;
    i = i + 1

#if(answer <= n[0]):
print(answer)
#else:
#    print(n[0])

Submission status: Accepted

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

def function(n,x,list):
  count = 1
  position = 0
  for l in list:
    position += l
    
    if position > x:
      break
    count += 1
   
  return count

print(function(n,x,l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
cnt = 1
d = 0
num = 0

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

print(cnt)

Submission status: Accepted

Solution code:
in1 = list(map(int, input().split()))
N = in1[0]
X = in1[1]
 
L = list(map(int, input().split()))
L.append(0)
L.append(0)
D = 0
overflow = False
for i in range(1, N+2):
  if X < D:
    print(i-1)
    overflow = True
    break
  if X == D:
    print(i)
    overflow = True
    break
  D = D + L[i-1]

if not overflow:
  print(N+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, X = map(int, input().split())
# スペース区切りの整数の入力
L = input().split()
answer = 1
sum = 0
for n in range(N):
  sum += int(L[n])
  if sum <= X:
    answer += 1
print(answer)

Submission status: Accepted

Solution code:
import numpy as np

n, x = map(int, input().split())
l = np.array(list(map(int, input().split())))
s = np.zeros(n + 1)

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

print(len(np.where(s <= x)[0]))

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
T=0
if sum(L) <= X:
  print(N+1)
else:
  for l,i in zip(L,range(N)):
    T=T+l
    if T > X:
      print(i+1)
      break

Submission status: Accepted

Solution code:

N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
# N += 1
# L.insert(0, 0)
# %%
cnt = 0
d = 0
curr = [0]
for n in range(N):
    if d <= X:
        cnt += 1
        d += L[n]
        curr.append(d)
    else:
        break
if d <= X:
    cnt += 1
print('{}'.format(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):
    d += L[i]
    if d <= X:
        ans += 1
    else:
        break
print(ans+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x = (int(x) for x in input().split())
l=list(map(int,input().split()))
k=0
d=0

while d<=x:
   if len(l)<=k:
    break
   else:
    d=d+l[k]
    k=k+1
if d<=x:
  print(k+1)
else:print(k)

Submission status: Accepted

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

count = 1
Sum = 0
while Sum <= X and count < N + 2:
    if count < N + 1:
        Sum += int(W.pop(0))
    count += 1
print(count-1)

Submission status: Accepted

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

count = 0
Di = 0
for i in range(nx[0]+1):

    if i != 0:
        Di += l[i-1]
    
    if Di > nx[1]:
        break
    
    count += 1
        
print(count)

Submission status: Accepted

Solution code:
import numpy as np

N, X = map(int, input().split())
a = np.fromstring(input(), dtype='i4', sep=' ')
ac = np.add.accumulate(a)
ans = np.searchsorted(ac, X, side='right')
print(ans + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#bin/usr/env python3

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

total_len = 0
for i in range(n):
    total_len += int(length[i])
    if total_len > x:
        print(i+1)
        break
    if i == n-1:
        print(n+1)

Submission status: Accepted

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

while i < N:
    step.append(nowstep + L[i])
    nowstep += L[i] 
    i += 1

for i in range(len(step)):
    if step[i] <= X:
        ans += 1
    else:
        pass

print(ans)

Submission status: Accepted

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

s = 0
pS = []
for i in range(N):
    s += List[i]
    pS.append(s)
    
pS = [0]+pS

if pS[-1]<=X:
    print(len(pS))
    
else:
    for j in range(N):
        if (pS[j]<=X)&(X<pS[j+1]):
            print(j+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

print(ans+1)

Submission status: Accepted

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

Submission status: Accepted

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

d = 0

truf = True

for a in range(n):
  d += l[a]
  if d > x:
    print(a+1)
    truf = False
    break

if truf:
  print(n+1)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
ln= list(map(int, input().split()))
result=[]
for i in range(0,100000):
    a=ln[:i]
    b=sum(a)
    result.append(b)
    if b>x:
        break
e=len(result)

if e>n+1:
    print(n+1)
else:
    print(e-1)

Submission status: Accepted

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

Submission status: Accepted

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

d = 0
for i,l in enumerate(L):
	d += l	
	if d > x:
		print(i+1)
		break
	elif i==n-1:
		print(i+2)
		break

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, X = [int(item) for item in input().split()]
L = [int(item) for item in input().split()][::-1]
D = 0
count = 0
while D <= X:
  if len(L)>0:
    l = L.pop()
    D += l
    count += 1
  else:
    count += 1
    break
  
print (count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
n,x = list(map(int, input().split()))
l = list(map(int, input().split()))
isum = 0
for i in range(1,n+1):
    isum += l[i-1]
    if isum > x:
        print(i)
        sys.exit()
print(n+1 if sum(l) <= x else i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
lst = list(map(int, input().split()))
score = 1
dp = 0
for i in range(n):
	if dp < x:
		dp += lst[i]
		score += 1
	elif dp == x:
		dp += lst[i]
		break
	else:
		score -= 1
		break
print(score)

Submission status: Accepted

Solution code:
s = input().split()
s = list(s)
s2 = input().split()
s2 = list(s2)
count=1
X = int(s[1])
count = 1
for i in s2:
    if i == ' ':
        continue
    X = X-int(i)
    if X < 0:
        break
    count += 1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
#a = [int(x) for x in input().split()]
n, x = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#p, q, r = map(int, input().split())
l = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re

def doit():
  p = 0
  res = 1
  for lx in l:
    p += lx
    if x < p:
      break
    res += 1
  
  return res

#print(doit([0] * 4))
#doit(s)
try:
  print(doit())
except Exception as e:
  print("e", e, file=sys.stderr)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

A = input()
B = input()

N,X = map(int,A.split())
L = np.array(list(map(int, B.strip().split())))

L_sum = 0
jump = 1

for i in range(N):
  L_sum += L[i]
  if(L_sum>X):
    jump += 0
  else:
    jump += 1

print(jump)

Submission status: Accepted

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

dist = 0
num = 1

for (i, v) in enumerate(L):
  dist += v
  if dist <= x:
    num += 1
    continue
  else:
    break
    
print(num)

Submission status: Accepted

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

a=0
count=1
for i in range(len(L)):
#     print(i)
#     print(L[i])
    a+=L[i]
#     print(a)
    if(a<=X):
#         print(a)
        count+=1
print(count)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    n, x = [int(i) for i in input().split()]
    l_list = [int(i) for i in input().split()]
    n += 1
    d = 0
    num = 1
    for i in range(1, n):
        d = d + l_list[i - 1] * (i <= n + 1)
        if d > x:
            break
        num += 1
    print(num)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

l=tuple(map(int,input().split()))
d=[0 for i in range(n+2)]


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

Submission status: Accepted

Solution code:
a = input().split()
n = int(a[0])
x = int(a[1])
l_str_list = input().split()
d = 0
answer = n + 1

for i in range(n):
  d += int(l_str_list[i])
  if d > x:
    answer = i + 1
    break
  if d == x:
    answer = i + 2
    break
print(answer)

Submission status: Accepted

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

for num in range(N + 1):
    if num > 0:
        D = D + list[num - 1]
    if D <= X:
        count += 1
print(count)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline

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

p = 0
count = 0

if p <= X:
    count += 1

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

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    N, X = [int(n) for n in input().split()]
    L = [int(n) for n in input().split()]
    now = 0
    res = 0
    for i in range(N):
        if now <= X:
            res += 1
        now += L[i]
    if now <= X:
        res += 1
    print(res)
main()

Submission status: Accepted

Solution code:
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
N = a[0]
X = a[1]
L = []
for i in range(len(b)):
    L.append(b[i])
list=[]
D=[]
D.append(0)
for l in range(1,N+1):
    c = D[l-1] + L[l-1]
    D.append(c)

for j in range(len(D)):
    if D[j] <= X:
        list.append(1)

print(len(list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N,X = map(int,input().split())

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


res = 0
i = 0
ans = 1
for i in range(N):
    res += li[i]
    ans += 1
    if res > X:
        ans -= 1
        break
print(min(ans,N+1))

Submission status: Accepted

Solution code:
def sol(inp=input):
    n,x=map(int,inp().split())
    ls=list(map(int,inp().split()))
    cumsum=0
    for i,l in enumerate(ls):
        cumsum+=l
        if cumsum>x:
            return (i+1)
    else: return n+1
print(sol())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


N,X = IL()
L = IL()

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

print(cnt)

Submission status: Accepted

Solution code:
N, X = map(int,input().split())
L = []
L = list(map(int, input().split()))
D = 0
Dtmp = 0
cnt = 1
# D2から開始
for i in range(0, N):
  D = Dtmp + L[i]
  if D <= X:
    Dtmp = D
    cnt = cnt + 1
  else:
    break

print(cnt)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
L=list(map(int,input().split()))
N=a[0]
X=a[1]
l=[0]
n=0
n1=0
while True:
    l.append(L[n]+l[n])
    n=n+1
    if n==N:
        break
while True:
    if l[n1]<=X:
        n1+=1
    else:
        print(n1)
        break
    if n1==N:
        if X>=l[-1]:
            print(n1+1)
            break
        else:            
            print(n1)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
posi = 0;cnt = 1;

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(i)

Submission status: Accepted

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

count = 1
d = 0

for li in l:
    d += li
    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()))
a = 0
li = [0]
for i in range(len(L)):
    a += L[i]
    li.append(a)

ans = 0
for x in li:
    if x <= X:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n,x=map(int,input().split())
L=input().split()
L=[int(i) for i in L]
count=0
l=0
while l<=x:
    if count>n-1:
        count=count+1
        break
    else:
        l=l+L[count]
        count=count+1
print(count)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
a=list(input().split())
count=0
d=0
i=0

while d<=x:
    if i==0:
        d=0
        count=1
        i+=1
    elif count<=n+1 and i<n+1:
        d=d+int(a[i-1])
        if d<=x:
            count+=1
            i+=1
        else:
            break;
    else:  
        break;
print(count)

Submission status: Accepted

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

bound=0
point=1

for n in range(N):
    bound=bound+L[n]
    if bound<=X:
        point+=1

print(point)

Submission status: Accepted

Solution code:

import numpy as np

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

print(sum(np.cumsum(L) <= X))

Submission status: Accepted

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

for i, num in enumerate(list_):
  l += num
  if l > x:
    print(i+1)
    break
else:
  print(n+1)

Submission status: Accepted

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

counter = 0
coordinate = 0

while counter < n+1 and coordinate<=x:
    counter+=1
    if counter == n+1:
        break
    else:
        coordinate += l_array[counter-1]


print(counter)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
Ls = list(map(int,input().split()))
	
count = 1
s = 0
for l in Ls:
	#print(s)
	s += l
	
	if X < s:
		break
		
	count += 1
		
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate

n, x = list(map(int, input().split()))
lll = list(map(int, input().split()))
lcc = list(accumulate(lll))
print(sum(d <= x for d in lcc) + 1)

Submission status: Accepted

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

d = 0
i = 0
if x > 0:
    while d <= x:
        d = d + l[i]
        i = i + 1
        if i >= n:
            break
    if d > x:
        print(i)
    elif d <= x:
        print(n+1)
elif x <= 0:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n, x= map(int, input().split())
ls = list(map(int, input().split()))

zahyo = 0
cnt = 0
for i in range(n):
    cnt += 1
    zahyo += ls[i]

    if zahyo > x:
        break

if zahyo <= x:
    cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

bound = [0]
for i in range(1, n+1):
    if i == 1:
        bound.append(lst[i-1])
    else:
        b = bound[i-1] + lst[i-1]
        bound.append(b)

ans = []
for i in bound:
    if i <= x:
        ans.append(i)

print(len(ans))

Submission status: Accepted

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

l_list = l.split(' ')

for i in l_list:
    cnt += int(i)
    if cnt > x:
        break
    ans += 1

print (ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

if __name__ == "__main__":
    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])

    answer_array = np.array(d) <= x
    print(sum(answer_array))