function charInput(str,num){
	var returnStr = "";
  	for (i=0; i < num ; i++) {
      returnStr = returnStr + str;
	}
  	return returnStr;
}
function Main(input){
  input = input.split("\n");
  tmp = input[0].split(" ");
  var N = parseInt(tmp[0]);
  var K = parseInt(tmp[1]);
  var S = input[1];
  var lastChar = "";
  var count0 = 0;
  var lastCount =0;
  var strTop = 0;
  var loopcount_mem = 0;
  //命令する回数(K回)ループ
  for ( i1 = 0 ; i1 < K ; i1++ ) {
    //その時最も長い"0"文字列を特定する
    lastCount = 0;
    loopcount_mem = 0;
    for ( i2 = 0 ; i2 < N ; i2++) {
      if ( S[i2] === "0" )  {
        count0 += 1;
      } else {
        count0 = 0;
      }
      if ( lastChar === S[i2] ) { 
          count0 += 1;
      } else {
          if ( count0 > lastCount ) {
            lastCount = count0;
            loopcount_mem = i2 - lastCount + 1;
          }
      }
    }
    //特定した"0"文字列を"1"に置き換える
    S = S.substr(0, loopcount_mem) + charInput("1",lastCount) + S.substr(loopcount_mem + lastCount, N);
	//console.log(S);
    //console.log(loopcount_mem);
    //console.log(lastCount);
  }
  //もっとも連続して逆立ちしている人を数える
  var count1 =0;
  lastCount =0;
  lastChar = "";
  for ( i3 = 0 ; i3 < N; i3++) {
    if (S[i3] === "1" ) {
        count1 += 1;
    } else {
        count1 = 0;
    }
  	if ( lastChar === S[i3]) {
		count1 += 1;
    } else {
        if ( count1 > lastCount ) {
          lastCount = count1;
        }
    }
  }
  console.log(lastCount);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));