#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 1;
int a[MAXN], pre[MAXN], num[MAXN];
int main() {
  int n, m;
  cin >> n >> m;
  int i;
  int Biggest = -1, Smallest = 0x7ffffff;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    Biggest = max(Biggest, a[i]);
    Smallest = min(Smallest, a[i]);
    num[a[i] - 1]++;
  }
  if (Biggest == Smallest) {
    cout << 0 << endl;
    return 0;
  }
  for (i = Biggest - 1; i >= Smallest; i--) {
    pre[i] = pre[i + 1] + num[i];
  }
  int ans = 1;
  int now = 0;
  for (i = Biggest; i >= Smallest; i--) {
    now += pre[i];
    if (now > m) {
      now = pre[i];
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
