n, k = gets.chomp.split.map(&:to_i)
s = gets.chomp
A = s.scan(/1{1,}/)
B = s.scan(/0{1,}/)
if A.size == 0 || B.size == 0
  p n
  exit
end
A, B = B, A if s[0] == "0"
o = [k, B.size].min
n = A.size - o
ans = Array.new(n, 0)
n.times do |i|
  o.times do |j|
    ans[i] += (A[i+j].size + B[i+j].size)
  end
  ans[i] += A[i+o].size
end
p ans.max