#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,a[N],x[N],dp[N],ji,ans;
int main()
{
	cin>>n>>k;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)a[i+1]=s[i]-'0';
	for(int i=1;i<=n;i++)x[i]=a[i]^a[i-1];
	for(int i=1;i<=n;i++)dp[i]=dp[i-1]+x[i];
	for(int i=1;i<=n;i++)
	{
		ji^=x[i];
		int lc=(upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp);
		ans=max(ans,lc-i);
	}
	cout<<ans<<endl;
	return 0;
}