#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int main() {
  map<int, int> mp;
  long long n, m, sum = 0, ans = 0;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  for (long long i = N - 1; i >= 0; i--) {
    if (mp[i] == n) break;
    if (sum + mp[i] > m) {
      ans++;
      sum = mp[i];
    } else
      sum += mp[i];
    mp[i - 1] += mp[i];
  }
  if (sum) ans++;
  cout << ans;
  return 0;
}
