#include<bits/stdc++.h>
using namespace std;
string s;
int ans,n,i,j,k;
int main()
{
    cin>>n>>k>>s;
    while(j<n)
    {
        while(j<n&&s[j]=='1')
            ++j;
        ans=max(ans,j-i);
        while(j<n&&s[j]=='0')
            ++j;
        --k;
        if(k<0)
        {
            while(i<n&&s[i]=='1')
                ++i;
            while(i<n&&s[i]=='0')
                ++i;
        }
        ans=max(ans,j-i);
    }
    cout<<ans<<endl;
    return 0;
}