local mmi, mma = math.min, math.max
local n, k = io.read("*n", "*n", "*l")
local s = io.read()
local list0, list1 = {}, {}
local spos = 1
local iszero = true
table.insert(list1, 0)
for i = 1, n do
  local b = s:byte(i) - 48
  if b == 0 then
    if not iszero then
      table.insert(list1, i - spos)
      iszero = true
      spos = i
    end
  else
    if iszero then
      table.insert(list0, i - spos)
      iszero = false
      spos = i
    end
  end
end
if iszero then
  table.insert(list0, n + 1 - spos)
  table.insert(list1, 0)
else
  table.insert(list1, n + 1 - spos)
end

if #list0 <= k then
  print(n)
else
  local len = 0
  for i = 1, k do
    len = len + list0[i] + list1[i]
  end
  len = len + list1[k + 1]
  local ret = len
  for i = k + 1, #list0 do
    len = len + list0[i] - list0[i - k] + list1[i + 1] - list1[i - k]
    ret = mma(ret, len)
  end
  print(ret)
end
