#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, k, a[200003], sum[200003], qan[200003], t, phi, ro, ans;
int main() {
  cin >> n >> k;
  for (long long i = 0; i < (long long)n; i++) {
    cin >> a[i];
    ro += a[i];
  }
  sort(a, a + n);
  phi = n * a[0];
  ro -= phi;
  if (ro == 0 || n == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = (long long)n - 1; i >= 0; i--) {
    sum[a[i]] = n - i;
  }
  for (long long i = (long long)a[n - 1] + 1 - 1; i >= 0; i--) {
    if (sum[i] == 0) sum[i] = sum[i + 1];
  }
  t = a[n - 1] + 1;
  for (long long i = (long long)t - 1; i >= 0; i--) {
    qan[i] = sum[i] + qan[i + 1];
    if (qan[i] > k) {
      ans++;
      qan[i] = sum[i];
      ro -= qan[i + 1];
      if (ro <= 0) {
        cout << ans << endl;
        return 0;
      }
    }
  }
  if (ro > 0) {
    cout << ans + 1 << endl;
    return 0;
  }
}
