object Main {
  def main(args: Array[String]): Unit = {
    val lines = io.Source.stdin.getLines().toSeq
    println(solve(lines))
  }

  def solve(lines: Seq[String]): String = {
    val Array(n, k) = lines.head.split(" ").map(_.toInt)
    val s = lines.tail.head.split("").filter(_.length > 0).map(_.toInt).toVector

    val (sittings, stands) = s.zipWithIndex.partition(_._1 == 0)
    var s2 = Vector[(Int, Int, Int)]()
    var previous = s(0)
    var from = 0
    for (i <- 1 to s.size) {
      if (i == s.size) {
        s2 = s2 :+ (previous, from, i - from)
      } else {
        val (which, _) = sittings.find(_._2 == i).orElse(stands.find(_._2 == i)).get
        if (which != previous) {
          s2 = s2 :+ (previous, from, i - from)
          previous = which
          from = i
        }
      }
    }

    var counts = Vector[Int]()
    for (i <- s2.indices) {
      counts = counts :+ (if (s2(i)._1 == 1) s2.slice(i, i + k * 2 + 1).map(_._3).sum else s2.slice(i, i + k * 2).map(_._3).sum)
    }
    counts.max.toString
  }
}
