#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  int ind1 = -1;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] == 1) ind1 = i;
  }
  int tmp = 0;
  tmp += (ind1 + (K - 1)) / (K - 1) - 1;
  tmp += ((N - ind1 - 1) + (K - 1)) / (K - 1) - 1;
  cout << tmp;
}
