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

int main(void){
	int n, k;
	string s;
	cin >> n >> k >> s;
	vector<int> a;
	int prev = s[0];
	a.push_back(0);
	for(int i = 1; i < n; ++i){
		if(prev!=s[i]) a.push_back(i);
		prev = s[i];
	}
	a.push_back(n);
	int ans = 0;
	for(int i = 0; i < a.size(); ++i){
		int m = 2*k+1;
		if(s[a[i]] == '0'){
			m--;
		}
		ans = max(ans, ((m+i<a.size())?a[m+i]:n) - a[i]);
		// cout << a[m+i] - a[i] << endl;
	}
	cout << ans << endl;
	return 0;
}