#include<iostream>
#include<queue>
using namespace std;
queue<int>q;
int c[100001];
int n,k,cnt,ans;
int main()
{
    c[0]=1;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        char a;
        cin>>a;
        c[i]=a-48;
        q.push(i);
        if(c[i]==0&&c[i-1]==1)cnt++;
        if(cnt>k)
        {
            cnt--;
            while(c[q.front()]==1)q.pop();
            while(c[q.front()]==0)q.pop();
        }
        //cout<<i-q.front()+1<<endl;
        ans=max(ans,i-q.front()+1);
    }
    cout<<ans;
    return 0;
}