#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N, K;
    cin >> N >> K;
    string s;
    cin >> s;
    s = '1' + s + '1';
    vector<unsigned long> kyokai({0});
    for(unsigned long i = 0; i <= N; ++i)if(s[i] != s[i + 1])kyokai.push_back(i);
    kyokai.push_back(N);
    auto M = kyokai.size();
    unsigned long ans{0};
    for(unsigned long i = 0; i < M; i += 2)ans = max(ans, kyokai[min(i + 2 * K + 1, M - 1)] - kyokai[i]);
    cout << ans << endl;
    return 0;
}