#include <bits/stdc++.h>
using namespace std;
char c;
inline void read(int &a) {
  a = 0;
  do c = getchar();
  while (c < '0' || c > '9');
  while (c <= '9' && c >= '0') a = (a << 3) + (a << 1) + c - '0', c = getchar();
}
int a[200001];
int n, k;
long long s[200001];
long long Ck(int val, int &pos, int Del) {
  long long V = 0;
  int L = 1, R = n, Mid;
  while (L < R) {
    Mid = L + R + 1 >> 1;
    if (a[Mid] >= val)
      L = Mid;
    else
      R = Mid - 1;
  }
  pos = R;
  V = Del * 1ll * (a[Del] - val) + (s[R] - s[Del]) - (R - Del) * 1ll * val;
  return V;
}
int main() {
  read(n), read(k);
  for (int i = 1; i <= n; i++) read(a[i]);
  sort(a + 1, a + 1 + n);
  for (int i = 1, j = n; i < j; i++, j--) {
    int t = a[i];
    a[i] = a[j];
    a[j] = t;
  }
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + a[i];
  int Del = 0;
  a[0] = a[1];
  int ans = 0;
  while (a[Del] ^ a[n]) {
    int L = a[n], R = a[Del] - 1, Mid, Last = Del;
    while (L < R) {
      Mid = L + R >> 1;
      long long dK = Ck(Mid, Del, Last);
      if (dK <= k)
        R = Mid;
      else
        L = Mid + 1;
    }
    ans++;
    Ck(L, Del, Last);
    a[Del] = L;
  }
  printf("%d\n", ans);
}
