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:
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    X, A= LI()
    
    if(X >= A):
        print(10)
    elif(X<A):
        print(0)
    return

# B


def B():
    N, X= LI()
    L=LI()
    
    ans=1
    D=0
    for i in range(2,N+2):
        D=D+L[i-2]
        if (D>X):
            break
        ans+=1
    print(ans)
    


    
    return

# C


def true():
    S = input()
    S = S[:-1]

    tmp = 0
    for x in range(1 << (len(S)-1)):
        func = S[-1]
        for i in range(len(S)-1):
            if(x & (1 << i)):
                tmp += int(func)
                func = S[-2-i]
            else:
                func = S[-2-i]+func
        tmp += int(func)
    print(tmp)

    return


def flagcounter(x):
    if (x == 0):
        return 0
    return flagcounter(x >> 1)+(x & 1)


def C():
    W, H, x,y=LI()
    
    if (W/2==x and H/2==y):
        print(W*H/2,1)
    else:
        print(W*H/2,0)

    return


# D


def D():

    a, b, x = LI()
    BIG = a*a*b/2
    if x > BIG:
        y = 2*b-(2*x/a/a)
        print(math.degrees(math.atan(y/a)))
    else:
        y = 2*x/a/b
        print(math.degrees(math.atan(b/y)))
    return

# E


def E():
    N, K = LI()
    A = LI()
    F = LI()
    A.sort(reverse=True)
    F.sort()
    cost = []
    for i in range(len(N)):
        cost.append(A[i]*F[i])

    a = F[cost.index(max(cost))]

    return

# F


def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")


def solution(S):
    # write your code in Python 3.6
    N = len(S)

    pass


# Solve
if __name__ == '__main__':

    B()

Submission status: Accepted

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

Submission status: Accepted

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


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

print(cnt)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
L = list(map(int, input().split()))
c = 1
D = 0
for i in L:	
    D = D + i
    if D > x:
        print(c)
        exit()
    c = c + 1
print(c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
p = 0
cnt = 1
for l in L:
	p += l
	if p <= X:
		cnt += 1
print(cnt)

Submission status: Accepted

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

from itertools import accumulate

Lcum = accumulate(L)

count = 1
for l in Lcum:
    if l > X:
        print(count)
        exit()
    else:
        count += 1

print(N+1)

Submission status: Accepted

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

g=0
k=0
for i in range(n):
    g+=a[i]
    if g<=x:
        k+=1
print(k+1)

Submission status: Accepted

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

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

print(ans+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)
        exit()
print(n+1)

Submission status: Accepted

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

l = [int(i) for i in input().split()]
d = 0
count = 1
for i in l:
    d = d + i
    if d <= x:
        count += 1

print(count)

Submission status: Accepted

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

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

D = [i for i in d if i <= x]
print(len(D))

Submission status: Accepted

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

Submission status: Accepted

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

# while d <= X:
#     if i >= i_max:
#         break
#     d += L[i]
#     i += 1
count = 1
total = 0
for i in range(len(L)):
    total += L[i]
    if total <= X:
        count += 1
print(count)

Submission status: Accepted

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

max_x = N + 1
start = [0]
for i in range(N):
  s = start[i] + L[i]
  if s <= X:
  	start.append(s)
  else:
    max_x = i+1
    break
print(max_x)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N,X = [int(i) for i in input().split()]
L = list(map(int, input().split()))

def D(i):
        if i == 0:
                return 0
        return D(i - 1)+ L[i - 1]

ans = 0
for i in range(N + 1):
    if D(i) <= X:
        ans += 1
print(ans)

Submission status: Accepted

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

ans = []

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC-130-B
N, X = map(int, input().split())
L = list(map(int, input().split()))
Di = 0
ans = 1
for Li in L:
    Di += Li
    if Di > X:
        break
    ans += 1
print(ans)

Submission status: Accepted

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

Sum = 0
Num = 1

for i in range(N):

    Sum += L[i]

    if Sum <= X:
        Num += 1
    else:
        break

print(Num)

Submission status: Accepted

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

a = 0
c = 1
for i in l:
	a += i
	if a > x:
		print (c)
		exit()
	c += 1
print (c)

Submission status: Accepted

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


c=1

D=0

for x in l:

  D=D+x


  if D<=X:
    c+=1

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(bisect.bisect_right(cusum, x))

Submission status: Accepted

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

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+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

N, X = map(int, (input().split()))
L = list(map(int, input().split()))
point = 0
count = 1

for x in range(0, N):
    point+=L[x]
    if(point<=X):
        count+=1
    if(point>=X):
        print(count)
        sys.exit()

print(count)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
now = 0
res = 1
for l in map(int, input().split()):
    now += l
    if now <= X:
        res += 1

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:break
    ans += 1
print(ans)

Submission status: Accepted

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

d = 0
c = 1

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

    
print(c)

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
l=list(map(int,input().split()))
l.insert(0,0)
n=a[0]
x=a[1]
t=0
cnt=0
for k in l:
  t+=k
  if(t<=x):
    cnt+=1
print (cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

ans = 1
d = 0

for i in L:
   d = d + i
   if d <= X:
       ans += 1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 1
d = 0

for i in range(n):
    d += li[i]
    if x >= d:
        count += 1

print(count)

Submission status: Accepted

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

for i in range(1, N + 1):
    D_list.append(D_list[i - 1] + L_list[i - 1])

for i in range(N + 1):
    if X < D_list[i]:
        print(i)
        exit()
    elif X == D_list[i]:
        print(i + 1)
        exit()

print(i + 1)

Submission status: Accepted

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

Submission status: Accepted

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

if d <= X:
  ans += 1
  
for l in L:
  d += l
  if d <= X:
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

l = [num for num in map(int, input().split(' '))]

# print(n, x, l)

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

bound = 1
coordinate = 0

for i in L:
	coordinate += i
	
	if coordinate <= X:
		bound += 1
	else:
		break
		
print(bound)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
ans = 0
ans += 1 # 0で跳ねる
prev = 0
for i in L:
  if prev + i <= X:
    ans += 1
  else:
    break
  prev += i
  
print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = [int(x) for x in input().split()]
D = [0] * (N+1)
buf = 1

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

l_sum = 0
ans = 1

for l1 in L:
    l_sum += l1
    if l_sum <= X:ans += 1
    else:break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
ans = 0


[N, X] = inpl()
listL = inpl()
nlistD = np.array([0]*(N+1))

for i in range(len(nlistD)-1):
    nlistD[i+1] = nlistD[i]+listL[i]

ans = (nlistD<=X).sum()


print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def print_ans(N, X, lr):
    """Test Case
    >>> print_ans(3, 6, [3, 4, 5])
    2
    >>> print_ans(4, 9, [3, 3, 3, 3])
    4
    """
    counter = 1
    ans_sum = 0
    for l in lr:
        ans_sum += l
        if ans_sum > X:
            break
        else:
            counter += 1
    print(counter)

if __name__ == '__main__':
    N, X = map(int, input().rstrip().split())
    lr = list(map(int, input().rstrip().split()))
    print_ans(N, X, lr)

Submission status: Accepted

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


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

tmp = [1 if di<=x else 0 for di in d]
ret=sum(tmp)

print(ret)

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
    else:
        count += 1

print(count)

Submission status: Accepted

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

k = 0
s = 1

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=(int(x) for x in input().split())
list = input().split()
list = [int(s) for s in list]
list.append(0)
d = 0
count = 0

for i in range(n+1):
    if d > x:
        break
    else:
        count = count + 1
        d = d + list[i]

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0


n,k=map(int,input().split())
l=list(map(int,input().split()))
for li in l:
    count+=li
    if count<=k:
        ans+=1
print(ans+1)

Submission status: Accepted

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

cnt = 0
for i in range(len(tmp)):
    if tmp[i] <= x:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N,X=map(int,input().split(' '))
L=list(map(int,input().split(' ')))
count=1
S=0
for x in L:
  S+=x
  if S<=X:
    count+=1
  else:
    break

print(count)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
d = [0]*(N+1)
d[0] = 0

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

print(sum(1 for x in d if x<=X))

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2019-11-14 17:27:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect_left as bi_l, bisect_right as bi_r
import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, x, *l = [int(i) for i in sys.stdin.read().split()]
    
    culmative_sum = list(itertools.accumulate(l))
    ans = 1 + bi_r(culmative_sum, x)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, X = map(int, input().split())
L = list(map(int,input().split()))

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,X=map(int,input().split())
    L=list(map(int,input().split()))
    ans=1
    D=0
    for i in L:
        D+=i
        if D<=X:
            ans+=1
        else:
            break
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, x = list(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)
        exit()

print(n + 1)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

N,X,*L = map(int,read().split())

answer = sum(x <= X for x in itertools.accumulate([0]+L))
print(answer)

Submission status: Accepted

Solution code:
from itertools import accumulate
from bisect import bisect

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

arr = list(map(int, input().split()))
cum_sum = [0] + list(accumulate(arr))

idx = bisect(cum_sum, x)
print(idx)

Submission status: Accepted

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

for l in L_list:
    d = d + int(l)
    if d <= x :
        count += 1
else:
    print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

D = 0
count = 1

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

Submission status: Accepted

Solution code:
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

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

    h = 0
    ans = 1
    for l in L_l:
        h = h + l
        if h > X:
            break
        else:
            ans = ans + 1

    print(ans)





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

# %%
# from atcoder_test import doTest
# doTest("abc130","b",main)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,a=map(int,input().split(" "))
l=list(map(int,input().split(" ")))
co=0
tot=0
for i in l:
    tot+=i
    if tot<=a:
        co+=1
print(co+1)

Submission status: Accepted

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

sum = 0
count = 1
for x in L:
    sum += x
    if sum <= X:
        count += 1
    else:
        break
print(count)

Submission status: Accepted

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

cnt = 1
d = 0

for i in range(n):
    d += ls_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()))

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())
arr = list(map(int,input().split()))
chk = 0
cnt = 1
for i in range(len(arr)):
    chk = chk + arr[i]

    if chk <= x:
        cnt += 1
    else:
        print(cnt)
        exit()

print(cnt)

Submission status: Accepted

Solution code:
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(6, [3, 4, 5]), 2)

    def test_2(self):
        self.assertEqual(think(9, [3, 3, 3, 3]), 4)


def solve():
    x, l = read()
    result = think(x, l)
    write(result)


def read():
    n, x = read_int(2)
    return x, read_int(n)


def read_int(n):
    return read_type(int, n)


def read_float(n):
    return read_type(float, n)


def read_type(t, n):
    return list(map(lambda x: t(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(x, l):
    count = 1
    s = 0
    for e in l:
        s += e
        if s > x:
            break
        count += 1
    return count


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Submission status: Accepted

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

now = 0
ans = 1
for i in ll:
    now += i
    if now <= x:
        ans += 1

print(ans)

Submission status: Accepted

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

print(len(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,x=map(int,input().split())
    L=list(map(int,input().split()))
    D=[0]*(n+1)
    for i in range(n):
        D[i+1]=D[i]+L[i]
    print(sum(D[i]<=x for i in range(n+1)))
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0
d = 0

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

    d += 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()))
ans = 1
tmp = 0
for i in range(n):
  tmp += l[i]
  if x >= tmp:
    ans += 1
  else:
    break   

print(ans)

Submission status: Accepted

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

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

print(ans)