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

a = []
b = "0"
s.size.times do |i|
  c = s[i]
  if c != b
    a[i] = a[i-1].to_i + 1
  else
    a[i] = a[i-1].to_i
  end
  b = c
end

max = a[-1]
temp = 0
(0..max).each do |i|
  l = a.bsearch_index{|x| x >= i}
  r = a.bsearch_index{|x|
    if i & 1 == 1
      x >= i + 2 * k + 1
    else
      x >= i + 2 * k
    end
  }
  if r
    r = r - 1
  else
    r = n-1
  end
  temp = [temp, r-l].max
end

puts temp + 1

