#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v;
  int a[n], mn = 1e9, mx = -1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    mn = min(mn, a[i]);
    mx = max(mx, a[i]);
    v.push_back(a[i]);
  }
  if (mn == mx) {
    cout << 0 << endl;
    return 0;
  }
  sort(v.begin(), v.end());
  int ans = 0;
  for (int i = mx; i >= mn;) {
    long long cnt = 0;
    ++ans;
    while (i >= mn && cnt <= k) {
      auto it = upper_bound(v.begin(), v.end(), i);
      int pos = v.end() - it;
      int add = pos;
      if (cnt + add > k) break;
      cnt += add;
      --i;
    }
  }
  cout << ans << endl;
}
