import java.math.*

fun main(args: Array<String>) {
    val (n, k) = readInputLine().split(" ").map { it.toInt() }
    val s = readInputLine().toCharArray()
    
    val changePoints = mutableListOf<Int>()
    
    changePoints.add(0)
    
    for (i in 1 until n) {
        if (s[i] != s[i - 1]) {
            changePoints.add(i)
        }
    }
    
    changePoints.add(n)

    var max = 0
    
    for (i in 0 until changePoints.size - 1) {
        if (s[changePoints[i]] == '0') {
            val maxIndex = if (i + k * 2 < changePoints.size) changePoints[i + k * 2] else n
            max = Math.max(max, maxIndex - changePoints[i])
        } else {
            val maxIndex = if (i + k * 2 + 1 < changePoints.size) changePoints[i + k * 2 + 1] else n
            max = Math.max(max, maxIndex - changePoints[i])
        }
    }
    
    println(max)
}
 
fun readInputLine(): String {
    return readLine()!!
}
