import scala.util.control.Breaks

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).toIndexedSeq

    var s2 = IndexedSeq[(Int, Int, Int)]()
    val b1 = new Breaks
    b1.breakable {
      var i = 0
      while (true) {
        val b2 = new Breaks
        b2.breakable {
          for (j <- i + 1 to s.size) {
            if (j == s.size || s(i) != s(j)) {
              s2 = s2 :+ (s(i), i, j - i)
              i = j
              b2.break()
            }
          }
        }
        if (i == s.size) b1.break()
      }
    }

    var counts = Seq[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
  }
}
