import java.util.*

fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map{it.toInt()}
    val S = readLine()!!
    val A = ArrayList<Pair<Char, Int>>()

    if (S[0] == '0') {
        A.add(Pair('1', 0))
    }

    var cc = S[0]
    var len = 0
    for (c in S) {
        if (cc == c) {
            len++
        } else {
            A.add(Pair(cc, len))
            len = 1
            cc = c
        }
    }
    if (len != 0) {
        A.add(Pair(cc, len))
    }

    var res = 0
    var k = K
    var l = 0
    var r = 0
    var sz = 0

    do {
        var updated = false

        while (r < A.size && k >= 0) {
            if (A[r].first == '0') {
                --k
            }
            sz += A[r].second
            if (k >= 0) {
                res = Math.max(res, sz)
            }
            r++
            updated = true
        }
        while (l < r && k < 0) {
            if (A[l].first == '0') {
                ++k
            }
            sz -= A[l].second
            if (k >= 0) {
                res = Math.max(res, sz)
            }
            l++
            updated = true
        }
    } while(updated);

    println(res)
}
