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

    val ss = mutableListOf<Int>()
    var prev = s[0]
    if(prev=='0') ss.add(0)

    var c=0
    for(i in 0..n-1){
        if(s[i]!=prev){
            ss.add(c)
            prev=s[i]
            c=1
        }else{
            c++
        }
    }
    ss.add(c)
    if(prev=='0')ss.add(0)

//    println(ss)

    val m = 2*k+1

    var r = ss.take(m).sum()
    var ans = r

    for(i in 2..ss.size-m step 2){
        r = r -ss[i-2]-ss[i-1]+ss[i+m-2]+ss[i+m-1]
        ans = Math.max(ans,r)
    }
    println(ans)
}
