#include <bits/stdc++.h>
using namespace std;
int n, k, h[200200], dp[200200];
long long sum[200200];
long long t[800800];
void upd(int v, int tl, int tr, int l, int r) {
  if (l > r) return;
  if (l == tl && r == tr)
    t[v]++;
  else {
    int m = (tl + tr) / 2;
    upd(v + v, tl, m, l, min(r, m));
    upd(v + v + 1, m + 1, tr, max(l, m + 1), r);
  }
}
long long get(int v, int tl, int tr, int l, int r) {
  if (l > r) return 0;
  if (l == tl && r == tr)
    return t[v];
  else {
    int m = (tl + tr) / 2;
    return get(v + v, tl, m, l, min(r, m)) +
           get(v + v + 1, m + 1, tr, max(l, m + 1), r);
  }
}
void dfs(int v, int tl, int tr) {
  if (tl == tr)
    return;
  else {
    int m = (tl + tr) / 2;
    t[v + v] += t[v];
    t[v + v + 1] += t[v];
    dfs(v + v, tl, m);
    dfs(v + v + 1, m + 1, tr);
  }
}
void build(int v, int tl, int tr) {
  if (tl == tr)
    return;
  else {
    int m = (tl + tr) / 2;
    build(v + v, tl, m);
    build(v + v + 1, m + 1, tr);
    t[v] = t[v + v] + t[v + v + 1];
  }
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
  sort(h + 1, h + n + 1);
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + h[i];
  int mx = -1;
  for (int i = 1; i <= n; i++) mx = max(mx, h[i]);
  if (mx == 1) {
    cout << 0;
    return 0;
  }
  dp[mx - 1] = 1;
  int mn = 300300;
  for (int i = 1; i <= n; i++) mn = min(mn, h[i]);
  for (int i = 1; i <= n; i++) upd(1, 1, 2e5, 1, h[i]);
  dfs(1, 1, 2e5);
  build(1, 1, 2e5);
  int p = mx;
  for (int i = mx - 2; i >= mn; --i) {
    while (!(get(1, 1, 2e5, i + 1, p) <= k)) p--;
    dp[i] = dp[p] + 1;
  }
  cout << dp[mn];
  return 0;
}
