function Main(input) {
  var list = input.split("\n");
  var nk = list[0].split(" ");
  var N = nk[0];
  var K = nk[1];
  var S = list[1].split("");
  S.map( function(value){
    return parseInt(value);
  })
  
  var count, rev;
  var state = 0;
  var maxcount = 0;
  
  for(i=0;i<N;i++){
    count = 0;
    state = 1;
    rev = 0;
    while(rev <= 2*K) {
      if(S[i+count] != state) {
        rev++;
        state = 1 - state;
      } else count++;
    }
    if (count > maxcount) maxcount = count;
  }
  console.log(maxcount);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));