#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, c = 0, k, r, l = 0;
  scanf("%lld%lld", &n, &m);
  long long a[n], d[n];
  for (i = 0; i < n; i++) {
    scanf("%lld", a + i);
  }
  sort(a, a + n, greater<long long>());
  for (i = 1; i < n; i++) {
    d[i] = a[i - 1] - a[i];
  }
  for (i = 1; i < n; i++) {
    if (d[i] >= l / i) {
      k = d[i] - l / i;
      c += k / (m / i);
      r = k % (m / i);
      if (r > 0) {
        c++;
        l = m - r * i;
      } else {
        l = 0;
      }
    } else {
      l -= d[i] * i;
    }
  }
  printf("%lld\n", c);
}
