#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long MAXN = 2 * 1e5 + 5;
const long long INF = 1e10;
const long long MOD = 1e9 + 7;
long long N, K;
long long H[MAXN];
bool check() {
  for (int i = (0); i < (N - 1); i++)
    if (H[i] != H[i + 1]) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> K;
  for (int i = (0); i < (N); i++) {
    cin >> H[i];
  }
  sort(H, H + N);
  if (check()) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 0, elems = N;
  while (elems >= 2) {
    int k = elems - 1;
    long long sum = 0;
    while (k >= 1) {
      sum += (H[k] - H[k - 1]) * (N - k);
      if (sum > K) break;
      k--;
    }
    sum -= (H[k] - H[k - 1]) * (N - k);
    H[k] -= max((K - sum) / (N - k), 0LL);
    if (H[k] == H[k - 1]) k--;
    elems = k + 1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}
