object Main extends App {

  val line1 = io.StdIn.readLine.split(' ').map(_.toInt)
  val s = io.StdIn.readLine

  val N = line1(0)
  val K = line1(1)

  var previous = '-'

  var seq = Seq.empty[Int]
  var accum = 0

  for (i <- 0 until s.size) {
    s(i) match {
      case ss if ss == previous => accum += 1
      case ss if ss != previous && accum > 0=> {
        seq = accum +: seq
        accum = 1
      }
      case _ => accum += 1
    }
    previous = s(i)
  }

  if (accum > 0)
    seq = accum +: seq

  val num = if (s.head == '0') 2*K else 2*K+1
  val ans = seq.sliding(num).map(_.sum).max

  println(ans)

}