n, k = gets.split.map(&:to_i)
s = gets.chomp

ary = []
pre = "1"
c = 0
n.times do |i|
    if pre != s[i]
        ary << c
        c = 0
        pre = s[i]
    end
    c += 1
end
ary << c
ary << 0 if s[-1] == "0"
x = ary.size

k = 2 * k + 1
if x <= k
    puts ary[0..-1].inject(:+)
else
    ans = ary[0, k].inject(:+)
    sum = ans
    (k + 1).step(x, 2) do |i|
        sum += ary[i] + ary[i - 1]
        sum -= ary[i - k] + ary[i - k - 1]
        ans = sum if ans < sum
    end
    puts ans
end
