import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm;

void main(){
  long n, k;
  readf("%d %d\n", &n, &k);
  char[] s = readln.strip.dup;

  long i = 0;
  long[] xs = [];
  long[] ys = [];
  long c = 0;
  for (; i < s.length && s[i] == '1'; i++) {
    c++;
  }
  ys ~= c;
  while (i < s.length) {
    c = 0;
    for (; i < s.length && s[i] == '0' ; i++) {
      c++;
    }
    xs ~= c;

    c = 0;
    for (; i < s.length && s[i] == '1' ; i++) {
      c++;
    }
    ys ~= c;
  }

  long max = -1;
  foreach (a; 0..xs.length-k+1) {
    long x = ys[a+k];
    foreach (b; 0..k) {
      x += xs[a+b] + ys[a+b];
      write(xs[a+b], "+", ys[a+b], "+");
    }
    if (max < x) {
      max = x;
    }
  }
  if (max == -1) {
    writeln(s.length);
  } else {
    writeln(max);
  }
}
