import scala.io.StdIn
import scala.math._
import scala.collection.mutable.ArrayBuffer


object Main {

  class Zero(var l: Int, var r: Int) {
    override def toString: String = s"[$l,$r]"
  }

  def main(args: Array[String]): Unit = {
    val Array(n: Int, k: Int) = StdIn.readLine.split(" ").map(_.toInt)
    val as = StdIn.readLine.map(_ == '1')

    val B = ArrayBuffer[Zero]()
    B += new Zero(-1, -1)  // Sentinel
    B += new Zero(-1, -1)

    REP(n) { i =>
      if (!as(i)) {
        if (B.last.l == -1) B.last.l = i
        B.last.r = i
      } else if (B.last.l != -1) {
        B += new Zero(-1, -1)
      }
    }
    if (B.last.l != -1) B += new Zero(-1, -1)
    B.last.l = n
    B.last.r = n

    debug(B.mkString(" "))

    var ans = 0
    REP(B.length - 1) { l =>
      val r = min(l + k + 1, B.length - 1)
      val len = B(r).l - 1 - (B(l).r + 1) + 1
      ans = max(ans, len)
    }
    println(ans)

    debug(n, k)
    as.foreach {i => debugNoNewline(i, "")}
  }

  def DEBUG(f: => Unit): Unit = {
    if (false) { f }
  }

  def debug(something: Any): Unit = DEBUG {
    System.err.println(something)
  }
  def debugNoNewline(something: Any): Unit = DEBUG {
    System.err.print(something)
  }

  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while (i < N) { f(i); i += 1 }
  }

}