func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int m, n, i;   long long int a[1000000], ans, sum[1000000] = {0}, x;   int check(long long int k) {     x = 0;     for (i = 1; i <= n; i++) {       if (a[i] - (i - 1) / k > 0) x = x + a[i] - (i - 1) / k;     }     if (x >= m)       return 1;     else       return 0;   }   int binsearch(long long int low, long long int high) {     while (low < high) {       long long int mid = (low + high) / 2;       if (check(mid))         high = mid;       else         low = mid + 1;     }     if (!check(low)) low = -1;     return low;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (i = 1; i <= n; i++) {       cin >> a[i];     }     sort(a + 1, a + 1 + n, greater<int>());     for (i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];     ans = binsearch(1, n);     cout << ans;     return 0;   }   