#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> P;

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, K, cnt = 0, right = 0, ans = 0; cin >> N >> K;
    string S; cin >> S;
    for(int i=0;i<N;i++){
        while(right<N and (cnt<K or S[right]=='1')){
            if(S[right]=='0'){
                cnt++;
                while(right<N and S[right]=='0') right++;
            }
            else right++;
        }
        ans = max(ans, right-i);

        if(i<N-1 and S[i]=='0' and S[i+1]=='1') cnt--;
    }
    cout << ans << endl;
    return 0;
}