import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int n, k;
  readf("%d %d\n", &n, &k);
  auto ss = readln.chomp;
  auto num = new int[](ss.length+1);
  num[0] = 0;

  if (ss[0] == '0') {
    num[1] = 1;
  }
  foreach (i; 2..ss.length+1) {
    num[i] = num[i-1];
    if (ss[i-2] == '1' && ss[i-1] == '0') {
      num[i]++;
    }
  }
  
  //num.writeln;
  int res;

  foreach (l; 0..ss.length) {
    foreach (r; l+1..ss.length+1) {
      if (num[r] - num[l] > k) {
        res = max(res, r - 1 - l);
        break;
      }
      if (r == ss.length) {
        res = max(res, r - l);
        break;
      }
    }
  }

  res.writeln;
}
