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

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

i = 0

j = 0

sum = 0

m_l = float('inf')



while True:

	while j < N and sum < S:

		sum += As[j]

		j += 1

	

	if sum < S:

		break

	m_l = min(j-i, m_l)

	sum -= As[i]

	i += 1

	

"""

while j < N:

	sum += As[j]

	j += 1

	while i < j and sum :

		sum -= As[i]

		i += 1

		if sum >= S:

			continue

		m_l = min(j-i+1, m_l)

		break

"""

print((m_l if m_l != float('inf') else 0))

n,s = list(map(int, input().split()))

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

ans = float("inf")

ma = 0

mi = 0

v = 0

for i in range(n):

    v += a[i]

    if v >= s:

        ma = i

        while v >= s:

            v -= a[mi]

            mi += 1

        ans = min(ans, ma-mi+2)

ans = ans if ans != float("inf") else 0

print(ans)

N, S = list(map(int, input().split()))
As = list(map(int, input().split()))
i = 0
j = 0
sum = 0
m_l = float("inf")
while True:
    while j < N and sum < S:
        sum += As[j]
        j += 1
    if sum < S:
        break
    m_l = min(j - i, m_l)
    sum -= As[i]
    i += 1
"""
while j < N:
	sum += As[j]
	j += 1
	while i < j and sum :
		sum -= As[i]
		i += 1
		if sum >= S:
			continue
		m_l = min(j-i+1, m_l)
		break
"""
print((m_l if m_l != float("inf") else 0))

n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("inf")
ma = 0
mi = 0
v = 0
for i in range(n):
    v += a[i]
    if v >= s:
        ma = i
        while v >= s:
            v -= a[mi]
            mi += 1
        ans = min(ans, ma - mi + 2)
ans = ans if ans != float("inf") else 0
print(ans)

-N, S = list(map(int, input().split())) -As = list(map(int, input().split())) -i = 0 -j = 0 -sum = 0 -m_l = float("inf") -while True: -    while j < N and sum < S: -        sum += As[j] -        j += 1 -    if sum < S: -        break -    m_l = min(j - i, m_l) -    sum -= As[i] -    i += 1 -""" -while j < N: -	sum += As[j] -	j += 1 -	while i < j and sum : -		sum -= As[i] -		i += 1 -		if sum >= S: -			continue -		m_l = min(j-i+1, m_l) -		break -""" -print((m_l if m_l != float("inf") else 0)) +n, s = list(map(int, input().split())) +a = list(map(int, input().split())) +ans = float("inf") +ma = 0 +mi = 0 +v = 0 +for i in range(n): +    v += a[i] +    if v >= s: +        ma = i +        while v >= s: +            v -= a[mi] +            mi += 1 +        ans = min(ans, ma - mi + 2) +ans = ans if ans != float("inf") else 0 +print(ans)