object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N, K = sc.nextInt()
    sc.nextLine()
    val S = sc.nextLine()

    var left = 0
    var right = 0
    while (right < N && S(right) == '1')
      right += 1

    var i = 0
    while (i < K) {
      while (right < N && S(right) == '0')
        right += 1
      while (right < N && S(right) == '1')
        right += 1
      i += 1
    }

    var max = right - left
    while(left < N && S(left) == '0')
      left += 1

    while (left < N && right < N) {
      while (left < N && S(left) == '1')
        left += 1
      while (left < N && S(left) == '0')
        left += 1
      while (right < N && S(right) == '0')
        right += 1
      while (right < N && S(right) == '1')
        right += 1
      max = Math.max(max, right - left)
    }

    println(max)
  }

}