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

si = 9
counts = []
j = -1

(0..S.count-1).each do |i|
  if si != S[i]
    si = S[i]
    j += 1
    counts[j] = 1
  else
    counts[j] += 1
  end
end

i = 0
j = 0
sum = 0
maxsum = 0

if S[0] == 0
  while j < (K * 2) && j < counts.count
    maxsum += counts[j]
    j += 1
  end
  i += 1
  j = 0
end

while i < counts.count
  while j < (K * 2) + 1 && i+j < counts.count
    sum += counts[i+j]
    j += 1
  end

  if maxsum < sum
    maxsum = sum
  elsif sum == 0
    break
  end

  i += 2
  j = 0
  sum = 0
end

puts maxsum