import sys
input = sys.stdin.readline
n, s = map(int, input().split())
array = list(map(int, input().split()))
lst = [0] * (n + 1)
for i in range(1, n + 1):
lst[i] = lst[i - 1] + array[i - 1]
result = sys.maxsize
left = 0
right = 1
while left < n:
if lst[right] - lst[left] >= s:
if right - left < result:
result = right - left
left += 1
else:
if right < n:
right += 1
else:
left += 1
if result >= sys.maxsize:
print(0)
else:
print(result)