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

    // Generate compressed s
    val compressedList = mutableListOf<Int>()
    var before = 'X'
    var contineousNumber = 0
    if (S.first() == '0') {
        compressedList.add(0)
    }
    S.forEach {
        if (it == before) {
            contineousNumber++
        } else {
            if (before != 'X') {
                if (before == '1') {
                    compressedList.add(contineousNumber)
                } else {
                    compressedList.add(contineousNumber)
                }
            }
            contineousNumber = 1
        }
        before = it
    }
    compressedList.add(contineousNumber)
    if (S.last() == '0') {
        compressedList.add(0)
    }

    val cumilativeList = createCumilativeList(compressedList)
    var max = 0
    (0..(cumilativeList.size -1)).step(2 ).forEach{
        val from = it
        var to = from + (2 * K)

        val diff = if (from - 1 < 0) 0 else cumilativeList[from-1]
        if (to >= cumilativeList.size) {
            to = cumilativeList.size - 1
        }
        max = Math.max(max, cumilativeList[to] - diff)
    }
    println(max)
}

fun createCumilativeList(list: List<Int>) : List<Int> {
    val cumilativeList = mutableListOf<Int>()

    list.forEachIndexed { index, value ->
        if (index == 0) {
            cumilativeList.add(value)
        } else {
            cumilativeList.add(
                    cumilativeList.last() + value
            )
        }
    }

    return cumilativeList
}