import scala.collection.mutable.ArrayBuffer

object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N, K = sc.nextInt
    val S = sc.next

    val starts = ArrayBuffer[Int](0)
    val ends = new ArrayBuffer[Int]()
    var prev = ' '
    for (i <- 0 until S.length) {
      if (prev == '0' && S(i) == '1') {
        starts += i
      }
      if (prev == '1' && S(i) == '0') {
        ends += i
      }
      prev = S(i)
    }
    ends += S.length

    var result = 0
    for (i <- ends.indices) {
      val count =
        if (S(0) == '1') {
          if (i - K >= 0)
            ends(i) - starts(i - K)
          else
            0
        } else {
          if (i - K + 1 >= 0)
            ends(i) - starts(i - K + 1)
          else
            0
        }
      if (result < count) {
        result = count
      }
    }
    if (result == 0) {
      println(S.length)
    } else {
      println(result)
    }

  }
}