func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[1000002], b[4000000], intialsum[1000003];   int q(int ind) {     int sum = 0;     while (ind > 0) {       sum += b[ind];       ind -= ind & (-ind);     }     return sum;   }   void u(int ind, int n, int val) {     while (ind <= n) {       b[ind] += val;       ind += ind & (-ind);     }   }   int main() {     {       ios_base::sync_with_stdio(false);       cin.tie(0);     };     int i, j, k, l, n, m, t, h;     cin >> n >> k;     for (i = 1; i <= n; i++) {       cin >> j;       a[j]++;     }     for (i = 1; i <= n; i++) intialsum[i] = intialsum[i - 1] + a[i];     for (i = 1; i <= k; i++) {       cin >> j;       if (j > 0) {         a[j]++;         u(j, n, 1);       } else {         l = 1;         h = n;         while (h > l) {           m = (l + h) >> 1;           if (intialsum[m] + q(m) >= -j)             h = m;           else             l = m + 1;         }         a[l]--;         u(l, n, -1);       }     }     for (i = 1; i <= n; i++)       if (a[i] > 0) return cout << i << endl, 0;     cout << 0 << endl;     return 0;   }   