func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int MOD = 1e9 + 7;   long long int prime[10000000];   long long int fac[200100], ifac[200100];   long long int inv[200100];   vector<long long int> primes;   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   bool IsPrime(long long int x) {     if (x == 1) return false;     for (long long int i = 2; i * i <= x; i++) {       if (x % i == 0) return false;     }     return true;   }   void seive(long long int n) {     prime[0] = prime[1] = 1;     for (long long int i = 2; i * i <= n; i++)       if (!prime[i]) {         primes.push_back(i);         for (long long int j = i * i; j <= 1e6; j += i) prime[j] = 1;       }   }   bool sortMa7boub(const pair<long double, int>& a,                    const pair<long double, int>& b) {     if (a.first == b.first) return (a.second < b.second);     return (a.first > b.first);   }   bool IsVowel(char c) {     return (c ==  a  || c ==  e  || c ==  i  || c ==  u  || c ==  o  ||             c ==  y  || c ==  A  || c ==  E  || c ==  I  || c ==  U  ||             c ==  O  || c ==  Y );   }   bool IsEqual(string s1, string s2) {     if (s1.length() != s2.length()) return 0;     for (int i = 0; i < s1.length(); i++)       if (s1[i] != s2[i]) return 0;     return 1;   }   long long int powMod(long long int base, long long int pw) {     long long int ret = 1;     while (pw) {       if (pw & 1) ret = (ret * base) % MOD;       base = (base * base) % MOD;       pw >>= 1;     }     return ret;   }   void makeFact() {     fac[0] = ifac[0] = 1;     for (long long int i = 1; i < 200100; i++) {       fac[i] = (fac[i - 1] * i) % MOD;       ifac[i] = powMod(fac[i], MOD - 2);     }   }   inline void Init() {     inv[1] = 1;     for (int i = 2; i < 200100; ++i)       inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;   }   long long int C(long long int a, long long int b) {     if (a < b) return 0;     return (((fac[a] * ifac[b]) % MOD) * ifac[a - b]) % MOD;   }   long long int P(long long int a, long long int b) {     if (a < b) return 0;     return (fac[a] * ifac[a - b]) % MOD;   }   long long int sum(long long int k) { return (k % MOD) * ((k + 1) % MOD) / 2; }   long long int pascalDivisibility(long long int n, long long int p) {     long long int ans = 1;     long long int i = 0;     while (n) {       ans = (sum(n % p) % MOD) * (powMod(sum(p), i) % MOD) +             ((n % p + 1) % MOD) * (ans % MOD);       ans %= MOD;       n /= p;       i++;     }     return ans % MOD;   }   bool PointInRectangle(long double x1, long double y1, long double x2,                         long double y2, long double x, long double y) {     return (x >= x1 && x <= x2 && y >= y1 && y <= y2);   }   bool InRange(long long int a, long long int b, long long int c) {     return a >= b && a <= c;   }   string AL =  ABCDEFGHIJKLMNOPQRSTUVWXYZ ;   long long int arr[200100];   long long int level[200100];   vector<long long int> rang;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n, k, x, mx(0), mn(2 * 1e18);     cin >> n >> k;     set<long long int> ss;     for (int i = 0; i < n; i++)       cin >> x, arr[x]++, mx = max(mx, x), mn = min(mn, x);     long long int sum = 0;     for (int i = 200100 - 1; i > 0; i--) {       sum += arr[i];     }     long long int cnt(0);     long long int sumi = 0;     for (long long int i = mx; i > mn; i--) {       sumi += arr[i];       level[i] = sumi;     }     for (long long int i = mx; i > mn;) {       long long int sumo = 0;       while (sumo < k) {         sumo += level[i];         i--;       }       if (sumo > k) i++;       cnt++;     }     cout << cnt << endl;     return 0;   }   