fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val s = readLine()!!
    val xs = f(s)

    var r = 0

    for (i in (0 until xs.size step 2)) {

        val l = if (i + 2 * k < xs.size) {
            i + 2 * k
        } else {
            xs.size - 1
        }

        val x = xs[l] - (if (i > 0) xs[i - 1] else 0)

        r = Math.max(r, x)
    }

    println(r)
}

private fun f(s: String): List<Int> {
    val xs = mutableListOf(0, 0)

    if (s[0] == '0') {
        xs.add(0)
    }

    if (s.length == 1) {
        xs.add(1)
        return xs
    }

    var x = 1
    var c = s[0]
    s.substring(1).forEach {
        if (it != c) {
            xs.add(xs.last() + x)
            x = 0
        }
        x++
        c = it
    }

    xs.add(xs.last() + x)

    if (s.last() == '0') {
        xs.add(xs.last())
    }

    return xs
}