#include <bits/stdc++.h>
using namespace std;
long long int M = 1e9 + 7;
long long int n, k;
long long int x, y, z, t, q, u, a1, l, r;
long long int a[300007];
long long int vis[100001];
long long int b[100007];
map<long long int, long long int> dp;
long long int dp1[507][507];
long long int sum[100007][2];
long long int s[5007];
pair<long long int, long long int> p[27];
pair<long long int, long long int> p1[27];
bool check(long long int j, long long int i) {
  if ((p[i].second <= p[j].first) || (p[i].first >= p[j].second)) return true;
  return false;
}
long long int m, d;
vector<pair<long long int, long long int> > v[100007];
vector<long long int> v1[2001];
long long int m1[20000007];
bool cmp(pair<long long int, long long int> a,
         pair<long long int, long long int> b) {
  if (a.first == b.first) return 1;
  return a.first > b.first;
}
map<long long int, long long int> c;
long long int root;
vector<long long int> ans;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int mx = 1e10;
long long int solve(long long int i, long long int p) {
  if (i > mx) return i;
  if (p == 100) return i;
  if (dp.find(i) != dp.end()) return dp[i];
  long long int i1 = i;
  long long int s = 0;
  long long int s1 = 0;
  while (i1 > 0) {
    s += i1 % 10;
    i1 /= 10;
    s1++;
  }
  if (s1 == 1)
    dp[i] = min(solve(i + d, p + 1), s);
  else
    dp[i] = min(solve(s, p + 1), solve(i + d, p + 1));
  cout << dp[i] << " " << i << " " << p << endl;
  return dp[i];
}
const long long int mi2 = 2e7 + 5;
bitset<mi2> chk;
int main() {
  cin >> n >> k;
  map<long long int, long long int> m, m1;
  long long int mx = -1;
  long long int c = 0;
  long long int c4 = 1000000007;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a[i] = x;
    m[x]++;
    mx = max(mx, x);
    c4 = min(c4, x);
  }
  if (c4 == mx) return cout << 0, 0;
  c = m[mx];
  for (int i = mx - 1; i >= 0; i--) {
    if (m[i + 1] >= 0) {
      long long int c1 = c;
      c += m[i];
      m[i] += m[i + 1] + c1;
    }
  }
  for (int i = mx - 1; i >= 0; i--) {
    m1[i] = m[i + 1];
  }
  long long int c6 = 0;
  long long int k1 = k;
  long long int c7 = -1;
  for (int i = mx; i >= 1; i--) {
    if (k >= m1[i - 1]) {
      continue;
    }
    if (i <= c4) {
      break;
    }
    c7 = i;
    k = k1;
    k += m1[i];
    c6++;
  }
  if (c7 != c4) c6++;
  cout << c6;
}
