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

typedef long long ll;
typedef pair<int,int> P;

#define fr first
#define sc second

int main(){
	int n,k;
	string s;
	cin >> n >> k >> s;
	
	vector<int> vec;
	vec.push_back(0);
	int now = 1;
	for(int i = 0 ; i < n ; i ++){
		if(s[i]-'0' != now){
			vec.push_back(i);
			now = 1-now;
		}
	}
	for(int i = 0 ; i < 2*k+1 ; i ++)vec.push_back(n);
	
	int ret = 0;
	for(int i = 0 ; i+2*k+1 < vec.size() ; i += 2){
		ret = max( ret , vec[i+2*k+1]-vec[i] );
	}
	cout << ret << endl;
}