#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 > N / 2) num = N - num + 1;
      break;
    }
  }
  if (N == K) {
    cout << 1 << endl;
    return 0;
  }
  part = N - num + 1;
  int part1 = N - part + 1;
  if (num < K) {
    while (part >= K) {
      count++;
      part = part - K + 1;
    }
    if (num == 1) {
      if (part >= 2) {
        cout << count + 1 << endl;
        return 0;
      }
      if (part == 1) {
        cout << count << endl;
        return 0;
      }
    } else {
      if (part >= 2) {
        cout << count + 2 << endl;
        return 0;
      } else {
        cout << count + 1 << endl;
        return 0;
      }
    }
  } else {
    while (part >= K) {
      count++;
      part = part - K + 1;
    }
    while (part1 >= K) {
      count++;
      part1 = part1 - K + 1;
    }
    if (num == 1) {
      if (part >= 2) {
        cout << count + 1 << endl;
        return 0;
      }
      if (part == 1) {
        cout << count << endl;
        return 0;
      }
    } else {
      if (part1 >= 2) {
        if (part >= 2) {
          cout << count + 2 << endl;
          return 0;
        } else {
          cout << count + 1 << endl;
          return 0;
        }
      } else {
        if (part >= 2) {
          cout << count + 1 << endl;
          return 0;
        }
        if (part == 1) {
          cout << count << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}
