import scala.io.StdIn
import scala.math._

object Main {

  type RunLength = Tuple2[Int, Char]

  def encodeRunLength(enc: RunLength, s: String): RunLength = s match {
    case "" => enc
    case _ => s(0) match {
      case enc._2 => encodeRunLength((enc._1 + 1, enc._2), s.substring(1))
      case _ => enc
    }
  }

  def encode(encList: List[RunLength], s: String): List[RunLength] = s match {
    case "" => if (encList.last._2 == '0') ((0, '1'): RunLength) :: encList.reverse else encList.reverse
    case _ => {
      val enc = encodeRunLength((0, s(0)): RunLength, s)
      encode(enc :: encList, s.substring(enc._1))
    }
  }

  // (2K + 1, 今の最大数, 部分リスト)
  type State = Tuple3[Int, Int, List[RunLength]]

  def numSuccessiveOnes(state: State): Int = {
    if (state._3.size == 0) {
      state._2
    } else {
      val max = state._3.slice(0, state._1).foldLeft(0)((i, e) => i + e._1)
      numSuccessiveOnes((state._1, if (max > state._2) max else state._2, state._3.slice(2, state._3.size)))
    }
  }

  def main(args: Array[String]): Unit = {
    val Array(n, k) = StdIn.readLine.split(" ").map(_.toInt)
    val s = StdIn.readLine
    //s.foreach {println}
    val encList = encode(List[RunLength](), s)
    println(numSuccessiveOnes((2 * k + 1, 0, encList)))

  }
}