import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int solve (int n, int k, bool [] a)
{
	bool cur = false;
	int num = 0;
	int [] d;
	d ~= 0;
	foreach (ref c; a)
	{
		if (cur != c)
		{
			d ~= num;
			num = 0;
			cur = c;
		}
		num += 1;
	}
	d ~= num;
	d ~= 0;
	debug {writeln (d);}

	int [] s;
	s ~= 0;
	foreach (ref c; d)
	{
		s ~= s.back + c;
	}
	debug {writeln (s);}

	int res = -1;
	int delta = k * 2 + 1;
	for (int i = delta; i < s.length; i += 2)
	{
		debug {writeln (s[i], " ", s[i - delta]);}
		res = max (res, s[i] - s[i - delta]);
	}
	if (res == -1)
	{
		res = n;
	}
	return res;
}

void main ()
{
	int n;
	int k;
	while (readf (" %s %s", &n, &k) > 0)
	{
		readln;
		auto a = readln.strip.map !(q{a == '1'}).array;
		writeln (solve (n, k, a));
	}
}
