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:
#!/usr/bin/env python3
import sys


def solve(N: int, X: int, L: "List[int]"):
    d = [0]*(N+1)
    for i in range(1,N+1):
        d[i] = d[i-1] + L[i-1]

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

    print(ans)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    L = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, X, L)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8

N, X = map(int, input().split())
L_list =  [int(i) for i in input().split()]
total_dis = 0
counter = 1

for i in range(1, N + 1):
    total_dis += L_list[i - 1]
    if total_dis <= X:
        counter += 1
    else:
        break
print(counter)

Submission status: Accepted

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

#print(L)

D = [0]
count = 1

#print(bound)

for i in range(1, N+1):
    D.append(D[i-1] + L[i-1])
    if D[i] <= X:
        count += 1
    
#print(D)
print(count)

Submission status: Accepted

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


d = 0
ans = 1

for l_e in l:

    d += l_e

    if d > X:
        break
    else:
        ans += 1



print(ans)

Submission status: Accepted

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

D=0
dis = 0
count = 1
for i in L:
    D += i
    if D <= X:
        count += 1

print(count)

Submission status: Accepted

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

b = 1
sm = 0
for elu in L:
    sm += elu
    if sm > X:
        break
    b += 1

print(b)

Submission status: Accepted

Solution code:
import sys
def InputToInt():
    A = input().split()
    for i in range(len(A)):
        A[i] = int(A[i])
    return A

N, X = InputToInt()
A = InputToInt()

P = 0
for i in range(N):
    P += A[i]
    if P > X:
        print(i+1)
        sys.exit()
print(N+1)

Submission status: Accepted

Solution code:
import sys
n, x = map(int,input().split())
lList = list(map(int,input().split()))
counter = 1
position = 0
for i in lList:
  position += i
  if position <= x:
    counter += 1
  else:
    print(counter)
    sys.exit()
print(counter)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
llist = [0] + list(map(int, input().split())) + [1e9]
for i in range(1, n+2):
  llist[i] += llist[i-1]

for i in range(n+2):
  if llist[i] > x:
    break
print(i)

Submission status: Accepted

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

cum = 0
cnt = 0
for l in L:
    if cum > X:
        break
    cnt += 1
    cum += l

if cum <= X:
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
distance = [int(x) for x in input().split()]
from0 = 0
ans = 1
for i in range(N):
    if from0 + distance[i] <= X:
        ans += 1
    from0 += distance[i]

print("{}".format(ans))

Submission status: Accepted

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

total = 0
count = 1
for i in li:
  total += i
  count += 1
  if total == x:
    print(count)
    exit()
  if total > x:
    print(count-1)
    exit()
  
print(len(li)+1)

Submission status: Accepted

Solution code:
from sys import stdin
import numpy as np
# import math
# import random
# import fractions
# import sys
# sys.setrecursionlimit(100000)
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]

N, X = [int(x) for x in stdin.readline().rstrip().split()]
L = [int(x) for x in stdin.readline().rstrip().split()]
cnt = 1
n = 0
for l in L:
  n += l
  if n>X:
    break
  cnt += 1
print(cnt)

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

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify, heapreplace
from collections import defaultdict


class Solution:
    def main(self):
        N, X = map(int, input().split())
        L = [0] + list(map(int, input().split()))
        cum = 0
        res = 0
        for i in range(len(L)):
            cum += L[i]
            if cum <= X:
                # print(cum)
                res += 1
            else:
                break

        print(res)

if __name__ == '__main__':
    Solution().main()

Submission status: Accepted

Solution code:
from itertools import accumulate
from bisect import bisect
n,x = map(int,input().split())

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

D = [0]+list(accumulate(L))
i = bisect(D, x)
print(i)

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
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
import itertools

count = 1
a,b=map(int,input().split())
lst=list(map(int,input().split()))
for i in itertools.accumulate(lst):
    if i <= b:
        count += 1
print(count)

Submission status: Accepted

Solution code:
def main():
    inputs = input().split()
    N, X = int(inputs[0]), int(inputs[1])
    L = list(map(int, input().split()))

    D_old = 0.0
    count = 1
    for l in L:
        D = D_old + l
        if D <= X:
            count += 1
        D_old = D
    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

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):
  D = sum(L[j] for j in range(0,i))
  if D <= X:
    cnt = cnt + 1
print(cnt)

Submission status: Accepted

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

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

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

print(t)

Submission status: Accepted

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

Submission status: Accepted

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

flag = True
D = 0
for i in range(N):
    D += Ls[i]
    if D > X:
        print(i+1)
        flag = False
        break

if flag == True:
    print(N+1)

Submission status: Accepted

Solution code:
N, X = map(int, input().split()) # 横に2個
L = list(map(int, input().split())) # １行に別れてるとき
L.append(0)

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


print(count)

Submission status: Accepted

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

flag = True
d = 0
for i in range(n):
    d = d + ls[i]
    if d > x:
        flag = False
        break

if flag:
    print(i + 2)
else:
    print(i + 1)

Submission status: Accepted

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

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

Submission status: Accepted

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

while Di<=X:
    result+=1
    if result==N+1:
        break
    Di+=L[result-1]

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for j in l:
    if t <= x:
        ans += 1
    t += j

if t <= x:
    ans += 1

print(ans)

Submission status: Accepted

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

for a in l:
    if a <= x:
        count += 1
print(count)

Submission status: Accepted

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

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

print(i)

Submission status: Accepted

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

Submission status: Accepted

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

D = 0
c = 1

for i in range(N) :
  D = D + Ls[i]
  if D <= X :
    c = c + 1
    
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

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

#print(L)
print
count = 1

bouns = 0
for i in range(N):
    bouns += int(L[i])
   # print (bouns)
    if bouns <= X :
        count+=1
      #  print("!!")
print(count)

Submission status: Accepted

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

D = 0
count = 1

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

print count

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
x = 0

for v in L:
    x += v

    if x <= X:
        cnt += 1
    else:
        break

print(cnt)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
#b.py
n,x = map(int,input().split())
lis = list(map(int,input().split()))

ans = 1
now = 0
for _ in lis:
    now += _
    if x >= now:
        ans += 1
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
import sys
n,x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
for i, di in enumerate(l):
    d += di
    if x<d:
        print(i+1)
        sys.exit()
print(n+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
ls = []
ls = list(map(int,input().split()))
an = []
an.append(0)
for i in range(len(ls)):
    if i == 0:
        an.append(ls[i])
    else:
        an.append(ls[i] + an[i])
p = 0

for j in an:
    if j <= X:
        p+=1
print(p)

Submission status: Accepted

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

#d_1 = 0
cnt = 1
d = 0

for i in range(len(l)):
  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(" ")))

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    data = input().split()
    N = int(data[0])
    X = int(data[1])
    L = input().split()
    num = 1
    D = 0
    for i in range(N):
        D += int(L[i])
        if D <= X:
            num += 1
        else:
            break
    print(num)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,x = map(int, raw_input().split())
l = map(int,raw_input().split())
d=0
cnt = 1
for i in range(len(l)):
    d=d+l[i]
    if d <= x:
        cnt=cnt+1

print cnt

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate
from bisect import bisect
from sys import stdin

def main():
    N, X = map(int, input().split())
    L = map(int, input().split())

    l = list(accumulate(L))
    print(bisect(l, X) + 1)

input = lambda: stdin.readline()
main()

Submission status: Accepted

Solution code:
N,X = map(int, raw_input().split())
L = map(int, raw_input().split())
t = 1
now = 0
for i in L:
	now += i
	if(now > X):
		break
	t += 1
print(t)

Submission status: Accepted

Solution code:
import collections as c
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
N, X = ip()
L = list(map(int,input().split()))
d = 0
ans = 1
for i in range(N):
    d += L[i]
    if d <= X:
        ans+=1
    else:
        break
print(ans)

Submission status: Accepted

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

s = 0

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
#整数＋リスト
n, x = list(map(int, input().split()))
lll = list(map(int, input().split()))

y = 0
rtn = 1
for ii in lll:
    y += ii
    if (y <= x):
        rtn += 1


print(rtn)

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

D = 0
ans = 1

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


print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 1
d = 0

for i in range(len(l_ls)):
    d = d + l_ls[i]
    if d > x:
        break
    count = count + 1

print(count)

Submission status: Accepted

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

#1 回目は 座標 D1=0, 
#i 回目は 座標 Di=Di−1+Li−1(2≤i≤N+1) で跳ねます。
ans = 1
Before_Di = 0

for i in range(N):
  Di = Before_Di + L_list[i]
  #print(Di)
  if Di<=X:
    ans+=1
    Before_Di = Di
  else:
    break
    
print(ans)

Submission status: Accepted

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

output_list = [0] * (N + 1)
D = [0] * (N + 1)
D[0] = 0
output_list[0] = 0
for i in range(1, N + 1):
    D[i] = D[i - 1] + L[i - 1] 
    output_list[i] = D[i]
output = [x for x in output_list if x <= X]

print(len(output))

Submission status: Accepted

Solution code:
from sys import exit

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

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

ans = 1

x = 0

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

print(ans)

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 = list(map(int, input().split()))
L_list = list(map(int, input().split()))
c = 0
ans = 1
for i, l in enumerate(L_list):
    tmp = c+l
    if tmp>X:
        break
    c = tmp
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import numpy as np
import sys
import collections
import scipy.misc
import math
from operator import itemgetter
import itertools
import copy
import bisect

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
    

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

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

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

# 多次元配列の宣言（あとでintにすること。）（タプルにすること。）
dp = np.zeros((N+1, 4,4,4))
    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break
# 累積和
add = 1 # 問題によって決まる
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)

#２分探索
li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    

#ソート関数
org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)
# [3, 1, 4, 5, 2]
# [1, 2, 3, 4, 5]

#Distance Transformation
    for h in range(0,H):
        for w in range(0,W):
            if h == 0 and w == 0:
                pass
            elif h == 0:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h-1][W-w]+1)
            elif w == 0:   
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1)
            else:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1, D[H-h-1][W-w]+1, D[H-h][W-w]+2)
            d_max = max(D[H-h-1][W-w-1], d_max)

"""



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


def main():
    D = [0]*(N+1)
    res = 1
    for n in range(1,N+1):
        D[n] = D[n-1] + L[n-1]
        if D[n] <= X:
            res += 1
        
    print(res)
                
                
                
            
            
                

    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

if __name__ == '__main__':
    n,x = list(map(int, input().split()))
    l = list(map(int, input().split()))

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

Submission status: Accepted

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

D = 0
ans = 1

for i in L:
    D += 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()))

coutner = 1
d = 0

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

    if d > x:
        break
    else:
        coutner += 1


print(coutner)

Submission status: Accepted

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

k = []
kk = 0
k.append(kk)

for i in l:
    kk += i
    k.append(kk)

answer = 0
for j in k:
    if j <= x :
        answer += 1
    
print(answer)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

count=1

current=0

for _ in range(n):
    current+=l[_]
    count+=1
    if current > x:
        break



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

Submission status: Accepted

Solution code:

def main():
    num, x = map(int, input().split())
    data = list(map(int, input().split()))
    now = 0
    ans = 1
    for i in range(num):
        now += data[i]
        if now > x:
            break
        ans += 1

    print(ans)





if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=input().rstrip().split(" ")
n[1]=int(n[1])
n[0]=int(n[0])
i=0
l=""
seter=n[1]
d=0
ans=1
l=input().rstrip().split(" ")
for i in range(len(l)):
    l[i]=int(l[i])
    d=d+l[i]
    if(seter >=d):
        ans=ans+1
print(ans)

Submission status: Accepted

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

    D=D+L[i]
    if D>X:
        break
    
    cnt+=1
    
print(cnt)

Submission status: Accepted

Solution code:
# 2019 6/16
# ABC130 Bounding


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

L = [0]
D = 0

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


count = 1

for i in range(1, N + 1):
    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()))
LL = [0 for i in range(N+1)]
cnt = 1
for i in range(N):
    LL[i+1] = L[i] + LL[i]
    if LL[i+1] <= X:
        cnt += 1

# print(LL)
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(0, len(L)):
    res = B[i] + L[i]
    if res <= X:
        B.append(res)
    else:
        break
print(len(B))

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:
  if D+l > X:
    break
  else:
    D += l
    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, l in enumerate(L):
  d += l
  if d > X:
    print(i+1)
    exit()
print(i+2)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
c = list(map(int, input().split()))
counter = 1
p = 0
for i in range(a):
    p += c[i]
    if p <= b:
        counter += 1
    elif p > b:
        break
print(counter)

Submission status: Accepted

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



"""
import sys


def solve(N, X, L):
    ans = 0
    pos = 0
    while pos <= X and L:
        pos += L.pop(0)
        ans += 1
    return ans+1 if pos <= X else ans


def main(args):
    N, X = map(int, input().split())
    L = [int(l) for l in input().split()]
    ans = solve(N, X, L)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

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

for k in range(N+1):
    if A[k] <= X:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N, X = map(int, input().split())
l_list = np.array(input().split()).astype(int)


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

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = [int(i) for i in input().split()]
    l = [int(i) for i in input().split()]
    ans = 1
    m = 0
    for i in l:
        m += i
        if m <= n[1]:
            ans += 1
        else:
            break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
count = 0

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

print(ans)

Submission status: Accepted

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