#include<cstdio>
#include<cstring>
#include<iostream>
#include<cctype>
#include<iostream>
using namespace std;
const int N = 1e5 + 3;
char s[N];
int n,k,r;
int ans = 0;
int main(){
	scanf("%d%d",&n,&k);
	scanf("%s",s + 1);
	int l = 1,r = 1;
	int cnt = 0;
	while(1){
		while(r <= n && cnt < k){
			if(s[r] == '0'){
				while(r <= n && s[r] == '0') ++r;
				cnt++;
			}
			while(s[r] == '1') r++;
		}
	//	cout << r << endl;
		ans = max(ans,r - l);
		if(r > n) break;
		cnt--;
		while(s[l] != '0') l++;
		while(s[l] == '0') l++;
	}
	printf("%d\n",ans);
	return 0;	
}