object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val K = in.head.split(' ').tail.head.toInt
  val k = K * 2 + 1
  val S = in.tail.head
  //println(K, S)
  val n1s = S.split("0").filterNot(_=="").map(_.size)
  //println(S.split("0").toSeq)
  //println(n1s.toSeq)
  val n0s = S.split("1").filterNot(_=="").map(_.size)
  //println(n0s.toSeq)
  val zipped = if(S(0)=='0') n0s.zipAll(n1s, 0, 0) else n1s.zipAll(n0s, 0 , 0)
  val flat = 0 +: zipped.map(e => Array(e._1, e._2)).flatten :+ 0
  //println(flat.toSeq)
  var a = 0
  val acc = flat.map{e =>
    a+=e
    a
  }
  //println(acc.toSeq) 
  
  val ret = (0 until acc.size-k).foldLeft(0){ (a,i) =>
    val diff = acc(i+k) - acc(i)
    Math.max(a, diff)
  }
  println(ret)
}
