import std.stdio;
import std.string;
import std.conv;
import std.array;

void main()
{
    auto reader = readln.split;
    int N = reader[0].to!int;
    int K = reader[1].to!int;
    string S = readln.chomp;

    int[] cnt;
    int beforeI = 0;
    if (S[0] == '0') cnt ~= 0;
    foreach (i; 0..N){
        if (S[i] != S[beforeI]){
            cnt ~= i - beforeI;
            beforeI = i;
        }
    }
    cnt ~= N - beforeI;
    if (S[N - 1] == '0') cnt ~= 0;

    ulong cntLen = cnt.length;
    int sumRange = K * 2 + 1;
    int sum = 0;
    foreach (i; 0..sumRange){
        if (i >= cntLen) break;
        sum += cnt[i];
    }

    int ans = sum;
    for (uint i = 2; i + sumRange - 1 < cntLen; i += 2){
        sum -= cnt[i - 2];
        sum -= cnt[i - 1];
        sum += cnt[i + sumRange - 2];
        sum += cnt[i + sumRange - 1];

        if (sum > ans) ans = sum;
    }

    writeln(ans);
}

