function setUp(input) {
  input = input.split("\n");
  N = Number(input[0].split(' ')[0]);
  K = Number(input[0].split(' ')[1]);
  S = input[1];
  main();
}
function main() {
  oddList = [];
  evenList = [];

  S.split('0').forEach(function (d, i) {
    if (d.length) {
      oddList.push(d.length);
    }
  });
  S.split('1').forEach(function (d, i) {
    if (d.length) {
      evenList.push(d.length);
    }
  });
  oddRuiseki = getRuiseki(oddList);
  evenRuiseki = getRuiseki(evenList);

  var count = 0;
  var len = evenRuiseki.length
  for (var i = 0; i < len; i++) {
    var target = (oddRuiseki[i + K + 1] - oddRuiseki[i]) + (evenRuiseki[i + K] - evenRuiseki[i]);
    if (count < target) {
      count = target;
    }
  }

  console.log(count);
}
function getRuiseki(list) {
  var sum = 0;
  ret = [0];
  list.forEach(function (d, i) {
    sum += d;
    ret.push(sum);
  });
  return ret;
}

setUp(require("fs").readFileSync("/dev/stdin", "utf8"));
// setUp('14 2\n11101010110011')
// setUp('14 2\n00010101001100')