https://www.acmicpc.net/problem/1806

import sys
input = sys.stdin.readline
n,s = map(int, input().split())
data = list(map(int, input().split()))
end = 0
current_sum = 0
count = 0
answer = []
for start in range(n):
while current_sum < s and end < n:
current_sum += data[end]
end += 1
# 부분합 중에 그 합이 S 이상이 되는 것
if current_sum >= s:
answer.append(end-start) # end 가 항상 다음 요소를 가르키고 있다
current_sum -= data[start]
if answer == []:
print(0)
else:
print(min(answer))