#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, K, num = 0, count = 0, part = 0;
  cin >> N >> K;
  long long a;
  for (long long i = 0; i < N; i++) {
    cin >> a;
    if (a == 1) {
      num = i + 1;
      if (num > (long long)N / 2) num = N - num + 1;
      break;
    }
  }
  if (N == K) {
    cout << 1 << endl;
    return 0;
  }
  long long count1 = 0;
  part = N - num - 1;
  long long part1 = N - part - K;
  while (true) {
    if (part <= 0) break;
    count1++;
    part = part - K + 1;
  }
  while (true) {
    if (part1 <= 0) break;
    count1++;
    part = part - K + 1;
  }
  count1++;
  part = N - num;
  part1 = N - part - 1;
  while (true) {
    if (part <= 0) break;
    count++;
    part = part - K + 1;
  }
  while (true) {
    if (part1 <= 0) break;
    count++;
    part1 = part1 - K + 1;
  }
  if (count > count1) count = count1;
  cout << count << endl;
  return 0;
}
