class Bookmark
  attr_reader :index
  attr_accessor :head,:tail
  def initialize(index)
    @index = index
    @head = 0
    @tail = 0
  end
end

N, K = gets.split.map(&:to_i)
S = gets.chomp
B = (0 .. N).select{|i| i.zero? || i == N || S[i - 1] != S[i] }
  .map{|i| Bookmark.new(i)}

B.each_cons(2) do |a,b| 
    if S[a.index] == '1'
      d = b.index - a.index
      a.head = d
      b.tail = d
    end
  end

ans = (2 * K >= B.size) ? N : B.each_index.take_while{|i| (i + 2 * K) < B.size }
  .map{|i| B[i + 2 * K].index - B[i].index + B[i + 2 * K].head + B[i].tail }.max

puts ans