import java.lang.Math
fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map(String::toInt)
    val S = readLine()!!.toMutableList()
    for (i in 0 until S.size) {
        if (S[i] == '0') break
        S[i] = '0'
    }
    for (i in S.size-1 downTo 0) {
        if (S[i] == '0') break
        S[i] = '0'
    }
    val cnt = mutableListOf<Int>()
    cnt.add(1)
    for (i in 1 until S.size) {
        if (S[i] != S[i - 1]) {
            cnt.add(cnt[cnt.size-1])
        }
        cnt[cnt.size-1] += 1
    }
    var ans = cnt[Math.min(cnt.size-1, 2 * K - 1)]
    for (i in 1 until cnt.size step 2) {
        val ri = Math.min(cnt.size - 1, i + 2 * K)
        ans = Math.max(ans, cnt[ri] - cnt[i - 1])
    }
    println(ans)
}