nk = STDIN.gets().split(" ")
n = nk[0].to_i
k = nk[1].to_i
s = STDIN.gets().chomp

now_len = 0
pos = Array.new
s.each_char.with_index do |c, i|
  if c == "1"
    if now_len > 0
      pos.push [i - now_len, now_len]
    end
    now_len = 0
  else
    now_len += 1
  end
end

pos.sort! { |a, b| b[1] <=> a[1] }

if pos.length > 0
  for i in 0..k - 1
    for j in 0..pos[i][1] - 1
      s[pos[i][0] + j] = "1"
    end
  end
end

len = 0
now_len = 0

s.each_char do |c|
  if c == "0"
    if now_len > len
      len = now_len
    end
    now_len = 0
  else
    now_len += 1
  end
end

if now_len > len
  len = now_len
end

puts len
