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

a = s.split(/(?<=0)(?=1)|(?<=1)(?=0)/).map(&:size)

if s[0] == '0'
  a.unshift(0)
end
if s[-1] == '0'
  a.push(0)
end

ans = 0.step([0, a.size - k*2].max, 2).map do |i|
  a[i..(i + k*2)].inject(:+)
end.max

puts ans
