#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a[110000], b, c = 0, d = 0, e = 0;
  cin >> N >> b;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    if (a[i] == 1) c = i;
  }
  if ((c - 1) % (b - 1) != 0) d = 1;
  if ((N - c) % (b - 1) != 0) e = 1;
  cout << (c - 1) / (b - 1) + (N - c) / (b - 1) + d + e;
}
