N, K = gets.split(' ').map(&:to_i)
S = gets

lr = Array.new(N){Array.new}
c = 0
k = 0
N.times do |i|
  if c == 0 and S[i] == "1"
    c = 1
    lr[k][0] = i
  end
  if c == 1 and S[i] == "0"
    c = 0
    lr[k][1] = i - 1
    k += 1
  end
  if i == N - 1 and S[i] == "1"
    lr[k][1] = i
  end
end

val = 0
maxval = 0
if K > k
  maxval = N
else
  lr.reject!{|i| i.size == 0}
  lr.unshift([0, -1])
  lr.push([N, N-1])
  0.upto(k - K + 1) do |j|
    val = lr[j + K][1] - lr[j][0] + 1
    maxval = [val, maxval].max
  end
end

puts maxval