AtCoder Beginner Contest 130 - Bounding

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-----
3 6
3 4 5

-----Sample Output-----
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.

Source: atcoder | Difficulty: EASY


Solutions:
(N, X) = list(map(int, input().split()))
li = list(map(int, input().split()))
d = 0
c = 1
for i in range(N):
	d = d + li[i]
	if d <= X:
		c = c + 1
print(c)


(n, x) = list(map(int, input().split()))
L = list(map(int, input().split()))
dist = 0
res = 0
for (i, l) in enumerate(L, 1):
	dist += l
	if dist > x:
		print(i)
		return
	elif dist == x:
		print(i + 1)
		return
print(n + 1)


(N, X) = [int(i) for i in input().split()]
LS = [int(i) for i in input().split()]
s = 0
cnt = 1
for l in LS:
	s += l
	if s <= X:
		cnt += 1
	else:
		break
print(cnt)


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


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


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


from itertools import accumulate
from bisect import *
(N, X) = list(map(int, input().split()))
L = list(tuple(map(int, input().split())))
acc = sorted(list(accumulate(L)) + [0])
n = bisect_right(acc, X)
print(n)


(n, x) = map(int, input().split())
a = list(map(int, input().split()))
(b, ans) = (0, 1)
for i in a:
	b += i
	if b <= x:
		ans += 1
print(ans)


(n, x, *l) = map(int, open(0).read().split())
print(sum((x >= sum(l[:i + 1]) for i in range(n))) + 1)


import itertools
import bisect
(n, x) = map(int, input().split())
ll = list(map(int, input().split()))
dl = [0] + list(itertools.accumulate(ll))
print(bisect.bisect_right(dl, x))


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


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


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


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
D = 0
ans = 1
for Li in L:
	D += Li
	if D > X:
		break
	ans += 1
print(ans)


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


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


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


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
l = [0]
s = 0
for i in range(N):
	s += L[i]
	if s > X:
		break
	l.append(s)
print(len(l))


(n, x) = map(int, input().split())
l = list(map(int, input().split()))
d = 0
e = 1
for i in l:
	d = d + i
	if d <= x:
		e += 1
print(e)


(n, x) = map(int, input().split())
Ls = list(map(int, input().split()))
c = 1
z = 0
for l in Ls:
	z += l
	if z <= x:
		c += 1
print(c)


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


(n, x) = map(int, input().split())
l = list(map(int, input().split())) + [10 ** 5]
(d, cnt) = (0, 0)
while d <= x and cnt < n + 1:
	d += l[cnt]
	cnt += 1
print(cnt)


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


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


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


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


import sys

def input():
	return sys.stdin.readline().strip()

def I():
	return int(input())

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

def IR(n):
	return [I() for i in range(n)]

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

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

def S():
	return input()

def LS():
	return input().split()
INF = float('inf')
(n, x) = LI()
l = LI()
cnt = 1
d = 0
for i in range(n):
	if d + l[i] <= x:
		cnt += 1
		d += l[i]
	else:
		break
print(cnt)


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
ans = 1
d = 0
for l in L:
	d += l
	if X >= d:
		ans += 1
print(ans)


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
n = 1
x = 0
for l in L:
	x += l
	if x > X:
		break
	n += 1
print(n)


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
x = 0
t = 1
for l in L:
	x += l
	if x <= X:
		t += 1
print(t)


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


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


(N, X) = map(int, input().split())
(*L,) = map(int, input().split())
D = 0
ans = 1
for l in L:
	D += l
	if D <= X:
		ans += 1
print(ans)


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


(n, k) = map(int, input().split())
A = [int(i) for i in input().split()]
a = 0
ans = 1
for i in A:
	a += i
	if a <= k:
		ans += 1
print(ans)


(N, X) = list(map(int, input().split()))
Li = list(map(int, input().split()))
Di = 0
count = 1
for i in Li:
	Di = Di + i
	if Di <= X:
		count += 1
	else:
		break
print(count)


(n, x, *l) = map(int, open(0).read().split())
cnt = 1
d = 0
for i in range(n):
	d += l[i]
	if d <= x:
		cnt += 1
print(cnt)


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


(N, M) = map(int, input().split())
L = list(map(int, input().split()))
(ans, x) = (1, 0)
for l in L:
	x += l
	if x > M:
		break
	ans += 1
print(ans)


(n, x) = map(int, input().split())
ll = list(map(int, input().split()))
ans = 1
now = 0
for l in ll:
	now += l
	if now <= x:
		ans += 1
print(ans)


(N, X) = list(map(int, input().split()))
ls1 = list(map(int, input().split()))
x = 0
ii = 1
for i in ls1:
	x = x + i
	if x > X:
		break
	ii += 1
print(ii)


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


(n, x) = map(int, input().split())
(*l,) = map(int, input().split())
s = [0]
for i in range(n):
	s.append(s[i] + l[i])
print(sum((t <= x for t in s)))


(n, x) = map(int, input().split())
d = [0]
for l in map(int, input().split()):
	d.append(d[-1] + l)
print(sum((dx <= x for dx in d)))


(n, x) = map(int, input().split())
cnt = 1
now = 0
for l in map(int, input().split()):
	now += l
	if now > x:
		break
	cnt += 1
print(cnt)


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


(n, x) = map(int, input().split())
l = list(map(int, input().split()))
ans = 1
for y in l:
	x -= y
	if x >= 0:
		ans += 1
	else:
		break
print(ans)


(a, b) = input().split()
a = int(a)
b = int(b)
c = list(map(int, input().split()))
d = 0
e = 0
for i in range(a):
	if d + c[i] <= b:
		d = d + c[i]
		e = e + 1
	else:
		break
print(e + 1)


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


from collections import defaultdict

def mapt(fn, *args):
	return tuple(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	(n, x) = Input()
	l = Input()
	d = defaultdict(int)
	d[0] = 0
	ans = 0
	for i in range(1, n + 1):
		d[i] = d[i - 1] + l[i - 1]
	for i in d.values():
		if i <= x:
			ans += 1
	print(ans)
main()


(A, B) = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
ans = 0
count = 1
for i in l:
	ans += i
	if ans <= B:
		count += 1
print(count)


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


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


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


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


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


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


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
l = 0
result = 1
for n in L:
	l += n
	if l <= X:
		result += 1
print(result)


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


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


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


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
c = 0
for (i, a) in enumerate(L):
	c += a
	if c > X:
		print(i + 1)
		exit()
print(len(L) + 1)


(n, x) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
c = 1
for v in a:
	s += v
	if s <= x:
		c += 1
print(c)


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
(cum, count) = (0, 1)
for l in L:
	cum += l
	if cum <= X:
		count += 1
print(count)


(N, X) = map(int, input().split())
a = list(input().split())
s = 0
i = 0
while s <= X:
	i += 1
	if i == N + 1:
		break
	s += int(a[i - 1])
print(i)


(n, x) = map(int, input().split())
l = list(map(int, input().split()))
b = [0]
for i in l:
	b.append(b[-1] + i)
print(sum((i <= x for i in b)))


(n, X) = map(int, input().split())
l = list(map(int, input().split()))
sumList = [0]
for i in range(n):
	s = sumList[i] + l[i]
	if s > X:
		break
	sumList.append(s)
print(len(sumList))


(n, x) = map(int, input().split())
L = list(map(int, input().split()))
ans = 1
cnt = 0
for l in L:
	cnt += l
	if x >= cnt:
		ans += 1
print(ans)


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


(a, b) = map(int, input().split())
k = 1
s = 0
for i in map(int, input().split()):
	if s + i <= b:
		k += 1
	s += i
print(k)


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


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


(N, X) = map(int, input().split())
L = list(map(int, input().split()))[:N]
print(sum([sum(L[:l]) <= X for l in range(len(L) + 1)]))


(N, X) = [int(c) for c in input().split()]
L = [int(c) for c in input().split()]
n = 1
D = 0
for l in L:
	D += l
	if D > X:
		break
	n += 1
print(n)


(n, x) = map(int, input().split())
c = 0
for i in input().split():
	x -= int(i)
	c += 1
	if x <= 0:
		c += x == 0
		break
	c += c == n
print(min(n + 1, c))


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


import itertools
(N, X) = map(int, input().split())
L = [int(x) for x in input().split()]
ans = sum((x <= X for x in itertools.accumulate([0] + L)))
print(ans)


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


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


(N, X, *L) = map(int, open(0).read().split())
c = 1
s = 0
for l in L:
	s += l
	if s <= X:
		c += 1
	else:
		break
print(c)


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
c = [0]
count = 1
for i in range(a):
	c.append(c[i] + l[i])
	if c[i + 1] <= b:
		count += 1
print(count)


(n, x) = map(int, input().split())
l = map(int, input().split())
d = 0
c = 0
for i in l:
	d += i
	if d <= x:
		c += 1
print(c + 1)


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


(N, X) = list(map(int, input().split()))
L = list(map(int, input().split()))
current = 0
cnt = 1
for l in L:
	current += l
	if current > X:
		break
	cnt += 1
print(cnt)


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


(n, m) = map(int, input().split())
array1 = list(map(int, input().split()))
k = 1
q = 0
for i in range(n):
	q += array1[i]
	if q <= m:
		k += 1
print(k)


(a, b) = input().split()
d = 0
n = 1
l = input().split()
for p in range(int(a)):
	d += int(l[p])
	if d <= int(b):
		n += 1
print(n)


(n, x) = list(map(int, input().split()))
l = list(map(int, input().split()))
i = 0
p = 0
while i < n:
	p = p + l[i]
	if p > x:
		break
	i += 1
print(i + 1)


from typing import List

def next_coordinates(d: int, l: int) -> int:
	return d + l

def answer(n: int, x: int, l: List[int]) -> int:
	d = 0
	count = 1
	for i in l:
		d = next_coordinates(d, i)
		if x < d:
			return count
		count += 1
	return count

def main():
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	print(answer(n, x, l))

def __starting_point():
	main()
__starting_point()


(N, X) = map(int, input().split())
dis = 0
cnt = 1
for L in map(int, input().split()):
	dis += L
	cnt += dis <= X
print(cnt)


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


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


(n, x) = map(int, input().split())
L = [int(i) for i in input().split()]
a = 0
c = 1
for i in L:
	a += i
	if a <= x:
		c += 1
print(c)


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


(n, x) = map(int, input().split())
a = list(map(int, input().split()))
a.append(0)
count = 0
b = 0
for i in range(n + 1):
	if b > x:
		break
	count += 1
	b += a[i]
print(count)


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


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


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


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


import bisect
from itertools import accumulate
(N, X) = list(map(int, input().split()))
L = list(map(int, input().split()))
Lsum = list(accumulate(L))
ind = bisect.bisect_right(Lsum, X)
print(ind + 1)


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


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


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 1
d = 0
for i in b:
	d += i
	if d <= a[1]:
		c += 1
print(c)


(n, x) = map(int, input().split())
l = list(map(int, input().split()))
xlist = [0]
num = 0
for i in l:
	num += i
	xlist.append(num)
cnt = 0
for j in xlist:
	if j <= x:
		cnt += 1
print(cnt)


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


(N, X) = map(int, input().split())
(*L,) = map(int, input().split())
v = 0
ans = 1
for i in L:
	v += i
	if v <= X:
		ans += 1
print(ans)


(n, x) = map(int, input().split())
Y = list(map(int, input().split()))
Z = [0] * n
a = 0
for i in range(n):
	a += Y[i]
	Z[i] = a
import bisect
print(1 + bisect.bisect_left(Z, x + 1))


(n, x) = map(int, input().split())
l = list(map(int, input().split()))
cnt = 1
t = 0
for v in l:
	t += v
	if t > x:
		break
	cnt += 1
print(cnt)


(n, x) = map(int, input().split())
L = list(map(int, input().split()))
ans = 0
bns = 0
for i in L:
	bns += i
	if bns <= x:
		ans += 1
print(ans + 1)


(N, X) = list(map(int, input().split()))
i = list(map(int, input().split()))
d = 1
a = 0
for s in i:
	a += s
	if a <= X:
		d += 1
print(d)


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
bound = 1
d = 0
for i in L:
	d += i
	if d <= X:
		bound += 1
print(bound)


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


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


(n, x) = map(int, input().split())
from itertools import accumulate
L = [0] + list(map(int, input().split()))
acc = list(accumulate(L))
print(sum([1 for i in acc if i <= x]))


(n, x) = (int(i) for i in input().split())
z = [int(i) for i in input().split()]
(p, a) = (0, 1)
for i in z:
	p += i
	if p > x:
		break
	else:
		a += 1
print(a)


(n, x) = map(int, input().split())
li = list(map(int, input().split()))
lis = []
sum = 0
for i in range(n):
	sum += li[i]
	lis.append(sum)
cnt = 0
for i in lis:
	if i <= x:
		cnt += 1
print(cnt + 1)


(N, X) = map(int, input().split())
L = [int(x) for x in input().split()]
C = D = 0
while C < N:
	D += L[C]
	if D > X:
		break
	C += 1
print(C + 1)


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


(n, x, *l) = map(int, open(0).read().split())
l.insert(0, 0)
total = 0
cnt = 0
for l_ in l:
	total += l_
	if x < total:
		break
	cnt += 1
print(cnt)


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


(N, X) = map(int, input().split())
L = [int(i) for i in input().split()]
D = [0]
for i in range(N):
	a = D[i] + L[i]
	if a <= X:
		D.append(a)
	else:
		break
print(len(D))


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


(n, x) = map(int, input().split())
l = list(map(int, input().split()))
wa = 0
d = [0] * (n + 3)
d[1] = 0
d.pop(0)
wa = 1
for i in range(2, n + 2):
	d[i] = d[i - 1] + l[i - 2]
	if d[i] > x:
		break
	wa += 1
print(wa)


(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]
print(sum([i <= x for i in d]))


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


(x, y) = list(map(int, input().split()))
num_list = list(map(int, input().split()))
i = 1
distance = 0
for _ in num_list:
	distance += _
	if distance > y:
		break
	i += 1
print(i)


k = 0
s = 0
(a, b) = map(int, input().split())
L = list(map(int, input().split()))
for i in range(a):
	s += L[i]
	if s <= b:
		k += 1
print(k + 1)


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


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


(N, X) = list(map(int, input().split()))
L = list(map(int, input().split()))
List = [0] * (N + 1)
for i in range(1, N + 1):
	List[i] = List[i - 1] + L[i - 1]
import bisect
print(bisect.bisect_left(List, X + 1))


(n, x) = (int(i) for i in input().split())
list_l = [int(j) for j in input().split()]
tmp = 0
count = 0
for i in range(0, n + 1):
	if i == 0:
		pass
	else:
		tmp += list_l[i - 1]
		if tmp > x:
			break
	count += 1
print(count)


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


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
l = 0
A = 1
for i in L:
	l += i
	if l <= X:
		A += 1
print(A)


(n, x) = map(int, input().split())
(*l,) = map(int, input().split())
r = 0
ans = 1
for i in l:
	r += i
	if x >= r:
		ans += 1
print(ans)


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


(n, x, *L) = map(int, open(0).read().split())
D = [0] * (n + 1)
for i in range(1, n + 1):
	D[i] = D[i - 1] + L[i - 1]
print(sum((d <= x for d in D)))


(n, x) = map(int, input().split())
llist = list(map(int, input().split()))
dlist = [0]
d = 0
for i in llist:
	d += i
	dlist.append(d)
print(sum([i <= x for i in dlist]))


r = input().split()
N = int(r[0])
X = int(r[1])
d = [int(s) for s in input().split()]
ans = 1
le = 0
for i in range(N):
	le += d[i]
	if le > X:
		print(ans)
		break
	elif i == N - 1:
		print(N + 1)
	else:
		ans += 1


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


(N, X) = map(int, input().split())
Ls = list(map(int, input().split()))
ans = 1
D = 0
for L in Ls:
	D += L
	ans += D <= X
print(ans)


(n, x) = map(int, input().split())
arr = list(map(int, input().split()))
d = 0
ans = 1
for a in arr:
	d += a
	if d <= x:
		ans += 1
print(ans)


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


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


(n, x) = list(map(int, input().split()))
arr = list(map(int, input().split()))
if x == 0:
	print(0)
	return
sum = 0
count = 1
i = 0
while i < n:
	sum += arr[i]
	i += 1
	if sum <= x:
		count += 1
	else:
		print(count)
		return
print(count)


(n, x) = map(int, input().split())
L = list(map(int, input().split()))
val = 0
count = 1
for l in L:
	val += l
	if val <= x:
		count += 1
print(count)


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


(N, X) = list(map(int, input().split()))
L = list(map(int, input().split()))
S = [0]
sum_L = 0
for i in range(N):
	sum_L += L[i]
	S.append(sum_L)
counter = 0
for i in range(N + 1):
	if S[i] <= X:
		counter += 1
print(counter)


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
d = [sum(L[:i]) for i in range(N + 1)]
print(sum((i <= X for i in d)))


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


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
List = [0] * (N + 1)
for i in range(1, N + 1):
	List[i] = List[i - 1] + L[i - 1]
A = [i for i in List if i <= X]
print(len(A))


(n, x) = map(int, input().split())
l = [int(x) for x in input().split()]
ans = 1
s = 0
for ll in l:
	s += ll
	if s <= x:
		ans += 1
print(ans)


(n, x, *l) = map(int, open(0).read().split())
a = n + 1
i = sum(l)
while a > 1 and i > x:
	a -= 1
	i -= l[a - 1]
print(a)


(n, x) = map(int, input().split())
L = list(map(int, input().split()))
cnt = 0
pos = 0
for (itr, l) in enumerate(L):
	pos += l
	if pos > x:
		print(itr + 1)
		return
print(n + 1)


import sys
sys.setrecursionlimit(10 ** 9)

def int1(x):
	return int(x) - 1

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

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

def MI1():
	return list(map(int1, input().split()))

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

def LI1():
	return list(map(int1, input().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def MS():
	return input().split()

def LS():
	return list(input())

def LLS(rows_number):
	return [LS() for _ in range(rows_number)]

def printlist(lst, k=' '):
	print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
	(N, X) = MI()
	L = LI()
	A = [0] * (N + 1)
	for i in range(1, N + 1):
		A[i] = L[i - 1] + A[i - 1]
	ans = 0
	for a in A:
		if a > X:
			break
		ans += 1
	print(ans)

def __starting_point():
	solve()
__starting_point()


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


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


f = lambda : map(int, input().split())
(_, x) = f()
(c, d) = (1, 0)
for i in f():
	d += i
	if d > x:
		break
	c += 1
print(c)


(n, x) = map(int, input().split())
l = map(int, input().split())
cn = 1
ln = 0
for i in l:
	ln += i
	if ln > x:
		break
	cn += 1
print(cn)


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


(n, x) = map(int, input().split())
l = map(int, input().split())
cnt = 1
c = 0
for li in l:
	c += li
	if c <= x:
		cnt += 1
print(cnt)


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


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


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


(n, x) = map(int, input().split())
lis = list(map(int, input().split()))
d = 0
c = 1
for l in lis:
	d += l
	if d <= x:
		c += 1
print(c)


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


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


(n, x) = map(int, input().split())
li = list(map(int, input().split()))
s = [0]
a = 0
for i in li:
	a += i
	s.append(a)
l = [i for i in s if i <= x]
print(len(l))


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


(n, X) = map(int, input().split())
l = list(map(int, input().split()))
x = 0
m = 1
for d in l:
	x += d
	if x > X:
		break
	m += 1
print(m)


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


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


(N, X) = map(int, input().split())
s = list(map(int, input().split()))
d = 0
g = 1
for l in s:
	d = d + l
	if d > X:
		break
	g += 1
print(g)


(N, X) = (int(x) for x in input().split())
L = [int(x) for x in input().split()]
Bound = sum((sum(L[:x]) <= X for x in range(0, N + 1)))
print(Bound)


(n, x) = map(int, input().split())
li = list(map(int, input().split()))
ans = 1
D = 0
for i in li:
	D += i
	if D <= x:
		ans += 1
print(ans)


import itertools
import bisect
(n, x) = map(int, input().split())
l = list(map(int, input().split()))
a = list(itertools.accumulate(l, initial=0))
print(bisect.bisect_right(a, x))


(N, X) = map(int, input().split())
L = list(map(int, input().split()))
ans = 1
total = 0
for l in L:
	total += l
	if total > X:
		break
	ans += 1
print(ans)


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


(N, X) = map(int, input().split())
L = map(int, input().split())
B = 0
count = 1
for i in L:
	B = B + i
	if B <= X:
		count += 1
print(count)