
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let nk = lines.shift().split(/\s/).map((v) => v - 0);
    let N = nk[0], K = nk[1];
    let S = lines.shift().trim();
    let Nums = [];
    let now = 1;
    let cnt = 0;
    for (let i = 0; i < N; i++) {
        if (S.charAt(i) == now) cnt++;
        else {
            Nums.push(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0) Nums.push(cnt);
    if (Nums.length % 2 == 0) Nums.push(0);
    let Add = 2 * K + 1;
    let ans = 0;
//尺取法
    let left = 0;
    let right = 0;
    let tmp = 0;
    for (let i = 0; i < Nums.length; i += 2) {
        let nextLeft = i;
        let nextRight = Math.min(i + Add, Nums.length);
        while (nextLeft > left) {
            tmp -= Nums[left];
            left++;
        }
        while (nextRight > right) {
            tmp += Nums[right];
            right++;
        }
        ans = Math.max(tmp, ans);
    }
    console.log(ans);
}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));