fun main(args: Array<String>) {
    val (N, K) = listOfInt()
    val S = next().map { it - '0' }
    val A = mutableListOf<Int>()  //1・0の連続数
    var c = 0
    var h = 1   //1始まり
    S.forEach {
        if (it != h) {
            A.add(c)
            h = it
            c = 1
        } else c += 1
    }
    if (c > 0) A.add(c)
    if (A.size % 2 == 0) A.add(0)   //1終わり

    val W = Array(A.size + 1) { 0 }
    for (n in 0 until A.size) W[n + 1] = W[n] + A[n]
    var ans = 0
    for (n in 0 .. A.size - 1 step 2) {
        val left = n
        val right = Math.min(n + (2 * K + 1), A.size)
        val tmp = W[right] - W[left]
        if (ans < tmp) ans = tmp
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)