#include <bits/stdc++.h>
using namespace std;
long long i, j, n, m, x, y, cc, z, ans, t, b[200009], mx = 0, mn = 1e9;
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> x;
    b[x]++;
    mn = min(mn, x);
    mx = max(mx, x);
  }
  for (i = mx; i >= mn; i--) {
    b[i] += b[i + 1];
  }
  for (x = 0, i = mx; i >= mn; i--) {
    if (x + b[i] > m) {
      cc++;
      i++;
      x = 0;
    } else
      x += b[i];
  }
  if (x != b[mn]) cc++;
  cout << cc << endl;
  return 0;
}
