#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a, i, x, ans = -1, s = -1;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a;
    if (a == 1) s = i;
  }
  if (i == -1) cout << "0";
  for (int j = 0; j < k; j++) {
    x = s + k - 1 - j;
    if (s < n - 1) {
      for (i = 1; x < n - 1; i++) x += k - 1;
    } else
      i = 0;
    x = s - j;
    if (x > 0) {
      for (; x > 0; i++) x -= s - 1;
    }
    if (ans > i || ans == -1) ans = i;
  }
  cout << ans << endl;
  return ans;
}
