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;
  if (xs.length-k+1>0) {
    long last = ys[k];
    foreach (b; 0..k) {
      last += xs[b] + ys[b];
    }
    if (last > max) {
      max = last;
    }

    foreach (b; k..xs.length) {
      last -= xs[b-k] + ys[b-k];
      last += xs[b] + ys[b+1];

      if (last > max) {
        max = last;
      }
    }
  }

  if (max == -1) {
    writeln(s.length);
  } else {
    writeln(max);
  }
}
