#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long int INF = 20000000000;
long long int ans = 0;
long long int N, K, A[500010];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N >> K;
  for (int i = 0; i < signed(N); i++) cin >> A[i];
  long long int id = 0;
  for (int i = 0; i < signed(N); i++) {
    if (A[i] == 1) id = i;
  }
  ans += ((N - 1 - id) % (K - 1) == 0 ? (N - 1 - id) / (K - 1)
                                      : (N - 1 - id) / (K - 1) + 1) +
         ((id) % (K - 1) == 0 ? (id) / (K - 1) : (id) / (K - 1) + 1);
  cout << ans << endl;
}
