#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> v) {
  os << "( " << v.first << ", " << v.second << ")";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << " ";
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<set<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &v) {
  int i = 0;
  for (auto it : v) {
    if (i > 0) {
      os << ' ';
    }
    os << it;
    i++;
  }
  return os;
}
using Mod = ld;
ll say(ll x) {
  cout << "? " << x << endl;
  ll k;
  cin >> k;
  return k;
}
const int MAX_N = 3000;
vector<int> min_divs(MAX_N + 1, -1);
vector<int> primes;
void init() {
  for (long long x = 2; x <= MAX_N; ++x) {
    if (min_divs[x] == -1) {
      min_divs[x] = x;
      for (long long y = x * x; y <= MAX_N; y += x) {
        if (min_divs[y] == -1) min_divs[y] = x;
      }
    }
  }
  for (int x = 2; x <= MAX_N; ++x) {
    if (min_divs[x] == x) {
      primes.push_back(x);
    }
  }
}
bool check(int amid, vector<int> v) {
  int big_cnt = 0;
  int sma_cnt = 0;
  for (auto x : v) {
    if (x > 0) {
      if (amid <= x) {
        big_cnt++;
      } else {
        sma_cnt++;
      }
    } else {
      int place = -x;
      if (sma_cnt < place) {
        big_cnt--;
      } else {
        sma_cnt--;
      }
    }
  }
  if (big_cnt)
    return true;
  else
    return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  int A, B;
  cin >> A >> B;
  vector<int> v;
  for (int i = 0; i < A + B; ++i) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  int ng = int(1e9) + 1;
  int ok = 0;
  while (ok + 1 != ng) {
    int amid((ok + ng) / 2);
    if (check(amid, v)) {
      ok = amid;
    } else {
      ng = amid;
    }
  }
  cout << ok << endl;
  return 0;
}
