#include <bits/stdc++.h>
using namespace std;
struct Node{
	int l,r;
}a[100005];
int n,m,k;
string s;
int main(){
	m = 0;
	scanf("%d%d",&n,&k);
	cin >> s;
	for (int i = 0;i < n;++i){
		if (s[i] == '0'){
			a[m].l = i;
			while(s[++i] == '0'){

			}
			i--;
			a[m++].r = i;
		}
	}
	a[m].l = n;
	if (m <= k) return 0 * printf("%d\n",n);
	int ans = a[k].l;
	//cout << ans << endl;
	for (int i = 1;i + k-1 < m;++i){
		//cout << a[i+k].l-1 << " " << a[i-1].r << endl;
		//cout << a[i+k].l - 1 - a[i-1].r << endl;
		ans = max(ans,a[i+k].l - 1 - a[i-1].r);
	}
	printf("%d\n",ans);
	return 0;
}
/*
19 3
0101010101001111001
*/
