//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	
	int n, k; cin >> n >> k;
	string s; cin >> s;

	vector<int> a;
	vector<int> b;


	bool f = false;
	if (s[0] == '0') {
		f = true;
	}

	bool g = false;
	if (s[n-1] == '0') {
		g = true;
	}

	char prev = '0';
	for (int i = 0; i < n; i++) {

		if (prev=='1' && s[i]=='0') {
			a.push_back(i);
		}

		if(prev=='0' && s[i]=='1'){
			b.push_back(i);
		}

		if (s[i] == '0') {
			prev = '0';
		}
		else {
			prev = '1';
		}

		if (i == n - 1 && s[i] == '1') {
			a.push_back(n);
		}
	}


	int ans = 0;
	//左端が0でない
	if (f==false) {

		//右端が0でない
		if (g == false) {
			if (k >= a.size() - 1) {
				cout << n << endl;
				return 0;
			}
			else {
				
				for (int i = k; i < a.size(); i++) {
					ans=max(ans,a[i] - b[i - k]);
				}
			}
		}

		//右端が0のとき
		else {
			if (k >= a.size()) {
				cout << n << endl;
				return 0;
			}
			else {

				for (int i = k; i < a.size(); i++) {
					ans = max(ans, a[i] - b[i - k]);
				}

				ans = max(ans, n - (b[b.size() - k]));
			}
		}
		
	}
	//左端が0
	else {
		//右端が0でない
		if (g == false) {
			if (k >= a.size()) {
				cout << n << endl;
				return 0;
			}
			else {

				for (int i = k; i < a.size(); i++) {
					ans = max(ans, a[i] - b[i - k]);
				}

				ans = max(ans, a[k-1]);
			}
		}

		//右端が0のとき
		else {
			if (k >= a.size()+1) {
				cout << n << endl;
				return 0;
			}
			else {

				for (int i = k; i < a.size(); i++) {
					ans = max(ans, a[i] - b[i - k]);
				}

				ans = max(ans, a[k - 1]);
				ans = max(ans, n - b[b.size() - k]);
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1020