#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;
long long dp[N], tr[N];
long long n, k, mx, mi;
void update(int x, long long v) {
  while (x <= mx) {
    tr[x] += v;
    x += (x & (-x));
  }
}
long long query(int x) {
  long long res = 0;
  while (x > 0) {
    res += tr[x];
    x -= (x & (-x));
  }
  return res;
}
int main() {
  scanf("%I64d %I64d", &n, &k);
  mx = 0, mi = INF;
  for (int i = 1; i <= n; i++) {
    long long h;
    scanf("%I64d", &h);
    mx = max(mx, h);
    mi = min(mi, h);
    dp[1]++;
    dp[h + 1]--;
  }
  for (int i = 1; i <= mx; i++) {
    dp[i] = dp[i] + dp[i - 1];
    update(i, dp[i]);
  }
  int ans = 0;
  if (mx == mi) {
    printf("0\n");
    return 0;
  }
  int tmp = mx;
  for (int i = 0;; i++) {
    int r = tmp, l = 0, mid;
    long long sum1 = query(tmp), sum2, res = 0;
    while (l <= r) {
      mid = (l + r) >> 1;
      sum2 = query(mid);
      if (sum1 - sum2 <= k) {
        res = mid;
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    tmp = res;
    ans++;
    if (tmp <= mi) break;
  }
  printf("%d\n", ans);
  return 0;
}
