func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 6;   const int MAX = 1e7 + 7;   int n, k;   int a[N];   int dp[MAX];   bool can(int x) {     memset(dp, 0, sizeof(dp));     for (int i = x; i <= MAX; i++) {       dp[i] = max(1, dp[i / 2] + dp[(i + 1) / 2]);     }     int kk = k;     for (int i = 0; i < n; i++) {       kk -= a[i] < x ? 0 : dp[a[i]];       if (kk <= 0) {         return true;       }     }     return false;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     int lo = 0, hi = 1e7 + 100;     while (lo + 1 < hi) {       int mid = (lo + hi) / 2;       if (!can(mid)) {         hi = mid;       } else {         lo = mid;       }     }     cout << (lo == 0 ? -1 : lo) << endl;     return 0;   }   