#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100 * 2;
long long int a[maxn], b[maxn];
int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) == 2) {
    long long int minn = maxn + 10, maxx = 0;
    for (int i = 0; i < n; i++) {
      scanf("%I64d", &a[i]);
      minn = min(minn, a[i]);
      maxx = max(maxx, a[i]);
    }
    if (n == 1 || maxx == minn) {
      printf("0\n");
      continue;
    }
    for (int i = 0; i < n; i++) {
      a[i] -= minn;
      if (a[i] != 0) b[a[i] - 1]++;
    }
    maxx = maxx - minn;
    for (int i = maxx - 1; i >= 0; i--) b[i] += b[i + 1];
    int cnt = 1, box = m;
    for (int i = 0; i < maxx; i++) {
      while (b[i]) {
        if (box >= b[i]) {
          box -= b[i];
          b[i] = 0;
        } else {
          box = m;
          box -= b[i];
          b[i] = 0;
          cnt++;
        }
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
