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

xss = []
s.split('').each do |x|
  if xss.empty?
    xss.push([x])
  else
    if xss.last[0] == x
      xss.last.push(x)
    else
      xss.push([x])
    end
  end
end

# p xss

ans = 0
xss.each_with_index do |xs, i|
  # p [xs, i]
  ys = xs[0] == '0' ? xss.slice(i, 2 * k) : xss.slice(i, 2 * k + 1)
  # p ys
  ans = [ans, ys.map(&:size).reduce(0) { |acc, x| acc + x }].max
end

puts ans
