local n,k=io.read("n","n","l")
local s=io.read()
local t={1}
for i=2,#s do
    if s:byte(i-1)~=s:byte(i) then
        table.insert(t,i)
    end
end

local max=0
for i=1,#t do
    local x
    if s:byte(t[i])==48 then
        x=(t[i+2*k] or #s+1)-t[i]
    else
        x=(t[i+2*k+1] or #s+1)-t[i]
    end
    max=math.max(x,max)
end
print(max)