#include <bits/stdc++.h>
int main(void) {
  int i, n, k, m, o, l, r, bo = 0;
  int* a;
  scanf("%d %d", &n, &k);
  a = (int*)malloc(sizeof(int) * n);
  i = 0;
  while (i < n) {
    scanf("%d", &a[i]);
    if (a[i] == 1) o = i;
    i++;
  }
  l = o + 1;
  r = n - o;
  bo = l == r ? 1 : 0;
  i = 0;
  while (i * (k - 1) + 1 < l) {
    i++;
  }
  l = i;
  i = 0;
  while (i * (k - 1) + 1 < r) {
    i++;
  }
  r = i;
  printf("%d\n", l + r - bo);
}
