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

arr = []

# 必ず1から始める
if S[0] == '0'
  arr << 0
end


cnt = 1
N.times do |i|
  next if i == 0

  if S[i-1] == S[i]
    cnt += 1
  else
    arr << cnt
    cnt = 1
  end
end

arr << cnt

# 最後は1で終わらす
if S[-1] == '0'
  arr << 0
end

# 累積和
cumsum = []
cumsum << arr[0]

1.upto(arr.size-1) do |i|
  cumsum[i] = cumsum[i-1] + arr[i]
end

ans = 0

# p arr
# p cumsum

# ゼロのスペースの数
zero_cnt = (arr.size/2)

if K >= zero_cnt
  puts N
  exit
end

(zero_cnt - K + 1).times do |i|
  if i == 0
    tmp = cumsum[2*K]
  else
    tmp = cumsum[i*2+2*K] - cumsum[i*2-1]
  end

  # p tmp

  ans = [ans, tmp].max
end

p ans

