#include <bits/stdc++.h>
using namespace std;
string s;int k;
const int N = 1e5+5;
int n;
vector<int> v;
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>k>>s;
    s="*"+s;
    v.push_back(0);v.push_back(0);
    for(int l=1,r;l<=n;l=r+1){
        r=l;
        if(s[l]=='1')continue;
        while (r+1<=n&&s[r+1]=='0')r++;
        v.push_back(l),v.push_back(r);
    }
    v.push_back(n+1);v.push_back(n+1);
    int ans = 0;
    for(int i=0;i<v.size();i+=2){
        int r = min((int)v.size()-1,i+2*(k+2)-1);
        ans = max(ans,v[r-1]-v[i+1]-1);
    }
    cout<<ans<<endl;
}

