#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, idx, temp;
  cin >> n >> k;
  for (int(i) = (1); (i) <= (int)(n); (i)++) {
    cin >> temp;
    if (temp == 1) {
      idx = i;
    }
  }
  temp = idx;
  int ans = 0;
  bool first = true;
  while (temp > 0 and idx > 1) {
    if (!first) {
      temp++;
    }
    temp -= k;
    first = false;
    ans++;
  }
  first = true;
  temp = idx;
  while (temp <= n and idx < n) {
    if (!first) {
      temp--;
    }
    temp += k;
    first = false;
    ans++;
  }
  cout << ans << endl;
}
