n, k = gets.split.map(&:to_i)
s = gets.chomp.split("").map(&:to_i)
ary = [];
f = nil
s.each do |i|
  f.nil? || i.odd? != f ? ary << [i.odd?, 1] : ary[-1][1] += 1
  f = i.odd?
end

c = [ary.size-k*2-1, 0].max
res = (0..c).map do |i|
  len = k * 2 + 1
  len -= 1 unless ary[i][0]
  result_tmp = ary[i, len].inject(0){|s, e| s + e[1]}
  result_tmp
end.max

puts res
