"use strict"
function main(arg) {
    const N = arg.split("\n")[0].split(" ").map((x)=>{return parseInt(x)})[0]
    const K = arg.split("\n")[0].split(" ").map((x)=>{return parseInt(x)})[1]
    const S = arg.split("\n")[1].split("").map((x)=>{return parseInt(x)})
    let SS = [0], i, tmp = 1, ans = 0
    for (i = 0; i < N; ++i){
        if (S[i] == tmp){
            SS[SS.length-1]++
        }else{
            SS.push(1)
        }
        tmp = S[i]
    }
    if(SS.length%2 === 0) SS.push(0)
    for(i = 0; i < SS.length - 2*K; i+=2){
        tmp = SS.slice(i, i+2*K+1).reduce((a,x) => a+=x,0)
        if (tmp > ans) ans = tmp
    }
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));