-- D
local N, Kmax, _, tmp = io.read("n", "n", "l", "l")
local S = {}
local ZZ = string.byte('0')
for i=1, N do
    S[i] = string.byte(tmp, i, i) - ZZ
end
local llast, rlast = 1, 1
local k = 0
local left = 1
local ans = 0
for right=1, N do
    if rlast == 1 and S[right] == 0 then
        k = k + 1
    end
    rlast = S[right]
    while k > Kmax do
        left = left + 1
        if llast == 0 and S[left] == 1 then
            k = k - 1
        end
        llast = S[left]
    end
    local v = right - left + 1
    if ans < v then
        ans = v
    end
end
print(ans)
