import java.io.PrintWriter
import java.util.*
import kotlin.math.max

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, K) = nextIntList()
    val S = next()
    val list = ArrayList<P>()
    var i = 0
    while (i < N) {
        var j = i + 1
        while (j < N && S[i] == S[j]) j++
        list.add(P(S[i], j - i))
        i = j
    }
    var r = 0
    var k = 0
    var ans = 0
    var sum = 0
    for (l in list.indices) {
        while (r < list.size) {
            if (list[r].c == '0') {
                if (k == K) break
                k++
            }
            sum += list[r].l
            r++
        }
        ans = max(ans, sum)
        if (l == r) r++
        sum -= list[l].l
        if (list[l].c == '0') k--
    }
    println(ans)
}

data class P(val c: Char, val l: Int)