N, K = gets.split.map(&:to_i)
S = gets.chomp

a = S.chars.chunk(&:itself).map{|e, a| [e, a.size]}
if a.size/2 <= K
  puts S.length
else
  puts a.each_cons(2*K + 1).map{|a| a[0][0] == '0' ? a.take(2*K) : a}.map{|a| a.inject(0){|s, b| s + b[1]}}.max
end