#include<bits/stdc++.h>
using namespace std;

const int N=1e6+5;
int n,k,tl;
pair<int,int> lis[N];
char s[N];

void init()
{
	scanf("%d%d",&n,&k);int i;
	scanf("%s",s+1);lis[++tl]=make_pair(0,0);
	for(i=1;i<=n;++i)
	{
		if(s[i]=='1') continue;
		int r=i;
		while(s[r]==s[i]&&r<=n) ++r;--r;
		lis[++tl]=make_pair(i,r);
		i=r;
	}
	lis[++tl]=make_pair(n+1,n+1);
}

void work()
{
	if(tl-2<=k)
	{
		printf("%d\n",n);
		exit(0);
	}
	int i,ans=0;
	for(i=2;i<=tl-k;++i) ans=max(ans,lis[i+k].first-lis[i-1].second-1);
	printf("%d\n",ans);
}

int main()
{
	init();work();
	return 0;
}