const main = (input) => {
  var ip = input.trim().split("\n")[0].split(" ");
  var N = ip[0]-0;
  var K = ip[1]-0;
  if(N<=K/2){
    console.log(N);
    return;
  }
  var inputs = input.trim().split("\n")[1].split("");
  var maps = [];
  var tobj = {t:-1,s:-1,e:-1};
  for(var i=0;i<inputs.length;i++){
    if(tobj.t != inputs[i]-0){
      if(tobj.t != -1){
        tobj.e = i;
        maps.push(tobj);
        tobj = {t:-1,s:-1,e:-1};
      }
      tobj.t = inputs[i]-0;
      tobj.s = i;
    }
  }
  tobj.e = N;
  maps.push(tobj);
  var ans = 0;
  var omap = {}, zmap = {};
  var maxd = K*2;
  for(var s=0;s<maps.length;s++){
    var cnt = 0, zflg=false,zcnt=0;
    var mapst = maps[s];
    var mapen = maps[Math.min(maxd-1+mapst.t, maps.length-1)];
    ans = Math.max(ans, mapen.e-mapst.s+1);
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
