fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val s = readLine()!!

    var ans = 0
    var zero = if (s[0] == '0') 1 else 0

    var r = 0
    for (l in (0 until n)) {

        if (l > 0 && s[l - 1] == '0' && s[l] == '1') {
            zero--
        }

        while (r < n && zero <= k) {
            if (r > l && s[r - 1] == '1' && s[r] == '0') {
                zero++
            }
            r++
        }
        ans = Math.max(ans, r - l - if (zero > k) 1 else 0)
    }

    println(ans)
}
