func_code_string: #include <bits/stdc++.h>   using namespace std;   void debug_out() { cerr << endl; }   void clock_out() {     cerr <<   nTime Elapsed :   << 1.0 * clock() / CLOCKS_PER_SEC <<   s n ;   }   void fileio() {     freopen( /home/dwai/Desktop/cp/input.txt ,  r , stdin);     freopen( /home/dwai/Desktop/cp/output.txt ,  w , stdout);     freopen( /home/dwai/Desktop/cp/debug.txt ,  w , stderr);   }   void ofileio() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   template <typename Head, typename... Tail>   void debug_out(Head H, Tail... T) {     cerr <<     << H;     debug_out(T...);   }   int IT_MAX = 1 << 20;   const long long MOD = 1000000007;   const int INF = 0x3f3f3f3f;   const long long LL_INF = 0x3f3f3f3f3f3f3f3f;   const double PI = acos(-1);   const double ERR = 1e-10;   int main() {     42;     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     srand(time(NULL));     long long n, m;     cin >> n >> m;     long long a[n], b[m];     long long i;     long long mn = 0, mx = 0;     for (i = 0; i < n; i++) {       cin >> a[i];       if (i == 0) {         mx = a[i];         mn = a[i];       } else         mx = max(mx, a[i]);       mn = min(mn, a[i]);     }     long long ans = mn * 2;     for (i = 0; i < n; i++) {       if (a[i] > ans) ans = a[i];     }     for (i = 0; i < m; i++) {       cin >> b[i];       if (b[i] <= ans) return cout << -1, 0;     }     cout << ans;     return 0;   }   