function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],4)[0];
  var K = myconv(input[0],4)[1];
  var list = myconv(input[1],4);
  if(N == K){
     myout(1);
    return;
  }else if(K == 1){
     myout(N);      
    return;
	}
  //1の位置を特定し、左側と右側で何回K要素をとる必要があるか
  var index1 = 0;
  for(var i = 0; i < N; i++){
    if(list[i] == 1){
       index1 = i+1;
    }
  }
  var output = 0;
  var mae = 0;
  var ato = 0;
  if(index1 <= K){
    if(index1 == 1){
       mae = 0;
    }else{
      mae = 1;
      index1 = K;
    }
  }else{
    mae = 1;
    var tmpIndex1 = index1 - K; 
    mae += Math.ceil(tmpIndex1 / (K-1));
  }
  var ato = 0;
  if(N - index1 + 1 <= K){
    if(index1 == N){
       ato = 0;
    }else{
     ato = 1;
    }
  }else{
    ato = 1;
    var tmpIndex1 = (N - index1 + 1) - K;
    ato += Math.ceil(tmpIndex1 / (K-1));
  }
  myerr(mae);
  myerr(ato);
  myout(mae + ato);
}
Main(myin());