

function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var K = parseInt(input[0].split(" ")[1]);
  var S = input[1].split("");
  var cnt=0;
  var queue=[0];
  var ans=0;
  for(var i=0;i<N;i++){
    if(i==N-1){
      if(S[i]==1){
        ans=Math.max(ans,i-queue[0]+1);
      }else{
        if(S[i]!=S[i-1]){
          if(cnt>=K){
            ans=Math.max(ans,i-queue[0]);
            queue.shift();
          }else{
            ans=Math.max(ans,i-queue[0]+1);
          }
        }else{
          ans=Math.max(ans,i-queue[0]+1);
        }
      }
    }else if(i==0){
      if(S[i]==0){
        cnt++;
      }
    }else if(S[i]==0&&S[i]!=S[i-1]){
      if(cnt>=K){
        ans=Math.max(ans,i-queue[0]);
        queue.shift();
      }else{
        cnt++;
      }

    }else if(S[i]==1&&S[i]!=S[i-1]){
      queue.push(i);
    }
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));