n, q = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
ans = n+1
sum = 0
l = 0
r = 0
while l < n
  if l == r then
    sum = a[r]
    r += 1
  else
    if sum >= q then
      sum -= a[l]
      l += 1
    elsif r < n then
      sum += a[r]
      r += 1
    else
      break
    end
    ans = r - l if sum >= q && ans > r - l 
  end
end
if ans <= n
  puts ans
else
  puts 0
end