#include <bits/stdc++.h>
using namespace std;
int hoge(int i, int j) {
  if (i < 0)
    return 0;
  else {
    if (i % j == 0)
      return i / j;
    else
      return i / j + 1;
  }
}
int main() {
  int N, K;
  int array[N];
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> array[i];
  }
  int answer[3];
  int mini;
  for (int i = 0; i < N; i++) {
    if (array[i] == 1) {
      mini = i + 1;
      break;
    }
  }
  answer[0] = hoge(mini - 1, K - 1) + hoge(N - mini - 2, K - 1) + 1;
  answer[1] = hoge(mini - 2, K - 1) + hoge(N - mini - 1, K - 1) + 1;
  answer[2] = hoge(mini - 3, K - 1) + hoge(N - mini, K - 1) + 1;
  int minn;
  minn = min(answer[0], answer[1]);
  minn = min(minn, answer[2]);
  cout << minn << endl;
}
