#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> V(N);
  for (int &v : V) cin >> v;
  sort(V.rbegin(), V.rend());
  long long lastSliceRem = 0, ans = 0;
  for (int i = 1; i < N; ++i) {
    long long h = V[i - 1] - V[i];
    {
      long long t = min(h, lastSliceRem / i);
      h -= t;
      lastSliceRem -= t * i;
    }
    if (h == 0) continue;
    long long cc = K / i;
    ans += h / cc;
    h %= cc;
    if (h) {
      ans++;
      lastSliceRem = K - h * i;
    } else {
      lastSliceRem = 0;
    }
  }
  cout << ans << endl;
}
