_n, k = gets.split.map(&:to_i)
s = gets.chomp

# run length
ns = s.chars.chunk(&:itself).map { |(b, a)| [b.to_i, a.size] }
# /1(01)*/
ns.unshift [1, 0] if ns.dig(0, 0) == 0
ns << [1, 0] if ns.dig(-1, 0) == 0
# <len>
ns.map!(&:last)

# 累積和
sums = ns.inject([0]) { |a, n| a << a.last + n }
l = k * 2 + 1
p sums.each_cons(l).map { |a| a.last - a.first }.max
