
inputs = readlines

input=[]
for i in 1..inputs.size do
    input.push(inputs[i-1].split)
end

n = input[0][0].to_i
k = input[0][1].to_i
s = input[1][0].split("")

stack = []
if s[0] == "0"
    stack.push(0)
end

sum = 0
max = 0

count = 0
tar = s[0]

for i in 1..n do 
    if tar != s[i-1] 
        tar = s[i-1]
        stack.push(count)
        sum += count
        count = 1
        if stack.size > 2*k +1
            sum -= stack.shift
        end
        if tar == "0" and sum > max 
            max = sum
        end
    else
        count += 1
    end
end

stack.push(count)
sum += count
if s[n-1] == "0"
    stack.push(0)
    sum -= stack.shift
end

if stack.size > 2*k +1
    sum -= stack.shift
elsif stack.size == 1
    sum = n
end

if sum > max 
    max = sum
end

p max