#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main(){
	int N,K;
	string S;
	cin>>N>>K>>S;
	vector<int> c;
	c.push_back(0);
	for(int i=1;i<N;i++){
		if(S[i-1]!=S[i]) c.push_back(i);
	}
	int R=c.size();
	int ans=0;
	for(int i=0;i<R;i++){
		if(S[c[i]]=='1')
			if(i+2*K+1<R){
				ans=max(ans,c[i+2*K+1]-c[i]);
			}
			else ans=max(ans,N-c[i]);
		if(S[c[i]]=='0'){
			if(i+2*K<R){
				ans=max(ans,c[i+2*K]-c[i]);
			}
			else ans=max(ans,N-c[i]);
		}
	}
	cout<<ans;
}