#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  int pos = 1;
  while (true) {
    if (n <= pos) break;
    ans++;
    if (pos == 0)
      pos += k;
    else
      pos += k - 1;
  }
  cout << ans << endl;
  return 0;
}
