function Main(input) {
  var args = input.split(' ');
  var n = parseInt(args.shift());
  args = args.shift().split('\n');
  var k = parseInt(args.shift());
  var s = args.shift();
  var array = [];
  if (s[0] === '0') {
    array[0] = 0;
  }
  var current = 0;
  var before = null;

  for(var i = 0; i < n; i++) {
    if (!! before && before !== s[i]) {
      array[array.length] = current;
      current = 0;
    }
    current++;
    before = s[i];
  }
  array[array.length] = current;
  var klen = k * 2 + 1;
  if (array.length < klen) {
    var total = 0;
    for (var num of array) {
      total += num;
    }
    console.log(total);
    return;
  }
  var aklen = array.length - klen;
  var cnum = 0;
  for (var ii = 0; ii < klen; ii++) {
    cnum += array[ii];
  }
  var max = cnum;
  for (var j = 0; j < aklen; j = j + 2) {
    cnum += array[klen + j] + array[klen + j + 1] - array[j] - array[j + 1];
    max = max < cnum ? cnum: max;
  }
  console.log(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));