n, s = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_i)
l = r = sum = 0
li = ri = -1
min = nil
while true
    sum += r
    sum -= l
    if sum >= s
        min = ri - li if min.nil? || min > ri - li
        li += 1
        break if li == ri
        l, r = arr[li], 0
    else
        ri += 1
        break if ri == n
        l, r = 0, arr[ri]
    end
end
puts (min.nil? ? 0 : min)
