import sys
input = sys.stdin.readline
n,m = map(int, input().split())
arr = list(map(int, input().split()))
start = end = 0
_sum = arr[0]
minVal = int(1e9)
while True:
if _sum >= m:
minVal = min(minVal, end-start+1)
_sum -= arr[start]
start+=1
else:
end += 1
if end >= n:
break
_sum += arr[end]
if minVal == int(1e9):
print(0)
else:
print(minVal)