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);
    }
  });

  var maxLen = Math.min(oddList.length, evenList.length);
  ruiseki = [0];
  var sum = 0;
  for (var i = 0; i < maxLen; i++) {
    sum += oddList[i] + evenList[i];
    ruiseki.push(sum);
  }
  if (oddList.length > evenList.length) {
    ruiseki[maxLen] += oddList[maxLen];
  } else if (oddList.length < evenList.length) {
    ruiseki.push(sum + evenList[maxLen]);
  }

  var maxLen = ruiseki.length - K;
  var count = 0;
  for (var i = 0; i <= maxLen; i++) {
    var target = ruiseki[i + K] - ruiseki[i];
    if (target > count) {
      count = target;
    }
  }
  console.log(count);
}

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