object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N, K = sc.nextInt()
    sc.nextLine()
    val S: Array[Char] = sc.nextLine().toCharArray

    def standUp(S: Array[Char], i: Int, k: Int): Int =
      if (i >= N) i
      else if (k == 0) {
        var j = i
        while (S(j) == '1' && j < N)
          j += 1
        j
      } else
        if (S(i) == '0') {
          var j = i
          while (S(j) == '0' && j < N) {
            j += 1
          }
          standUp(S, j, k-1)
        } else standUp(S, i+1, k)

    val res = Math.max(standUp(S, 0, K), standUp(S.reverse, 0, K))
    println(res)
  }

}