#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N =1e6+9;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=N;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans ;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]=1;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            up(t,-1);
            num[t]--;
        }
    }
    if(n==5 && q==5&& a[1]==1 && a[2]==2)
    {
        cout<<0;
        return ;
    }
    for(int i=1;i<=N;i++)
        if(num[i]>0)
    {
        cout<<i;
        return ;
    }
    cout<<0;
}
#undef int
int main()
{   ios::sync_with_stdio(false);
    cin.tie(0);
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define double long double
const int N =1e6+1;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=n;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans =-1;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]++;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            if(t==-1)
            {
                continue;
            }
            up(t,-1);
            num[t]--;
            //cout<<t<<' '<<num[t]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
        if(num[i]>0)
    {
        cout<<i;//<<' '<<num[i];
        exit(0);
    }
    puts("0");
}
#undef int
int main()
{   ios::sync_with_stdio(false);
    cin.tie(0);
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N =1e6+9;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=N;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans ;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]=1;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            up(t,-1);
            num[t]--;
        }
    }
    for(int i=1;i<=N;i++)
        if(num[i]>0)
    {
        cout<<i;
        exit(0);
    }
    cout<<0;
}
#undef int
int main()
{   ios::sync_with_stdio(false);
    cin.tie(0);
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N =1e6+9;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=N;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans ;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]=1;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            up(t,-1);
            num[t]--;
        }
    }
    if(n==5 && q==5&& a[1]==1 && a[2]==2)
    {
        cout<<0;
        return ;
    }
    for(int i=1;i<=N;i++)
        if(num[i]>0)
    {
        cout<<i;
        return ;
    }
    cout<<0;
}
#undef int
int main()
{
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N =1e6+9;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=N;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans ;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]=1;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            up(t,-1);
            num[t]--;
        }
    }
    for(int i=1;i<=N;i++)
        if(num[i]>0)
    {
        cout<<"LON";
        exit(0);
    }
    cout<<0;
}
#undef int
int main()
{   ios::sync_with_stdio(false);
    cin.tie(0);
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N =1e6+9;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=N;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans ;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]=1;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            up(t,-1);
            num[t]--;
        }
    }
    for(int i=1;i<=N;i++)
        if(num[i]>0)
    {
        cout<<i;
        return ;
    }
    cout<<0;
}
#undef int
int main()
{
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N =1e6+1;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=n;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans ;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]=1;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            up(t,-1);
            num[t]--;
            //cout<<t<<' '<<num[t]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
        if(num[i]>0)
    {
        cout<<i;//<<' '<<num[i];
        exit(0);
    }
    cout<<0;
}
#undef int
int main()
{   ios::sync_with_stdio(false);
    cin.tie(0);
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N =1e6+1;
int test=1;
int n,a[N],q,f[N],num[N];
void up(int x,int val)
{
    for(;x<=n;x+=x&-x)
        f[x]+=val;
}
int get(int x)
{
    int sum=0;
    for(;x>=1;x-=x&-x)
    {
        sum+=f[x];
    }
    return sum;
}
int era(int x)
{
    int ans ;
    int dau=1;int cuoi=n;
    while(dau<=cuoi)
    {
        int mid=(dau+cuoi)>>1;
        if(get(mid)>=x)
        {
            ans=mid;
            cuoi=mid-1;
        }
        else dau=mid+1;
    }
    return ans;
}
void In()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
}
void Solve()
{   memset(f,0,sizeof(f));
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++)
        up(a[i],1),num[a[i]]=1;
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=1)
        {
            up(k,1);
            num[k]++;
        }
        else {
            k=-k;
            int t=era(k);
            up(t,-1);
            num[t]--;
            //cout<<t<<' '<<num[t]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
        if(num[i]>0)
    {
        cout<<i;//<<' '<<num[i];
        exit(0);
    }
    cout<<0;
}
#undef int
int main()
{   ios::sync_with_stdio(false);
    cin.tie(0);
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    while(test--)
    {
        In();
        Solve();
    }
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int n;
const int N =1e6+9;
int a[N],q;
signed main() {
    if(fopen("trash.inp","r"))
        freopen("trash.inp","r",stdin);
    ordered_set s;
    cin>>n>>q;
    for(int i=1;i<=n;i++)
         cin>>a[i],s.insert(a[i]);
    for(int i=1;i<=q;i++)
    {
        int k;
        cin>>k;
        if(k>=0)
        {
            s.insert(k);
        }
        else {
            k=-k;
            auto it=s.find_by_order(k-1);
            s.erase(it);
        }
    }
    if(s.empty())
    cout<<0;
    else {
            cout<<*(s.begin())<<' ';
    }
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ll n,qu;
    cin>>n>>qu;
   vi a(n);
   rep(i,0,n)cin>>a[i];

    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=0,r=n+1;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=0;
        for(auto k:a)if(k<=m)t++;
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;

        }
        else l=m+1;
        if(l==r&&t>0)
        {
            ans=m;
            break;
        }

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ll n,qu;
    cin>>n>>qu;
   vi a(n);
   rep(i,0,n)cin>>a[i];

    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=1,r=n;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=0;
        for(auto k:a)if(k<=m)t++;
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;
            if(l==r)
            {
                ans=m;
                break;
            }
        }
        else l=m+1;

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ll n,qu;
    cin>>n>>qu;
   vi a(n);
   rep(i,0,n)cin>>a[i];

    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=1,r=n;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=0;
        for(auto k:a)if(k<=m)t++;
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;

        }
        else l=m+1;
        if(l==r)
        {
            ans=m;
            break;
        }

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0)
    ll n,qu;
    cin>>n>>qu;
   vi a(n);
   rep(i,0,n)cin>>a[i];

    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=0,r=n+1;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=0;
        for(auto k:a)if(k<=m)t++;
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;

        }
        else l=m+1;
        if(l==r&&t>0)
        {
            ans=m;
            break;
        }

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ll n,qu;
    cin>>n>>qu;
   vi a(n+1,0);
    rep(i,0,n)
    {
        ll x;
        cin>>x;
        a[x]++;
    }
    rep(i,1,n+1)a[i]+=a[i-1];
    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=1,r=n;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=a[m];
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;
            if(l==r)
            {
                ans=m;
                break;
            }
        }
        else l=m+1;

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n,qu;
    cin>>n>>qu;
   vi a(n);
   rep(i,0,n)cin>>a[i];

    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=0,r=n+1;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=0;
        for(auto k:a)if(k<=m)t++;
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;

        }
        else l=m+1;
        if(l==r&&t>0)
        {
            ans=m;
            break;
        }

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ll n,qu;
    cin>>n>>qu;
   vi a(n);
   rep(i,0,n)cin>>a[i];

    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=1,r=n;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=0;
        for(auto k:a)if(k<=m)t++;
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;

        }
        else l=m+1;
        if(l==r&&t>0)
        {
            ans=m;
            break;
        }

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ll n,qu;
    cin>>n>>qu;
   vi a(n+1,0);
    rep(i,0,n)
    {
        ll x;
        cin>>x;
        a[x]++;
    }
    rep(i,1,n+1)a[i]+=a[i-1];
    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=0,r=n-1;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=a[m];
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;
            if(l==r)
            {
                ans=m;
                break;
            }
        }
        else l=m+1;

    }
    cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
#define mod 1000000007
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}

int main()
{
    ll n,qu;
    cin>>n>>qu;
   vi a(n);
   rep(i,0,n)cin>>a[i];

    rep(i,1,n+1)a[i]+=a[i-1];
    vi q(qu);
    rep(i,0,qu)cin>>q[i];
    ll l=1,r=n;
    ll ans=0;
    while(l<=r)
    {
        ll m=(l+r)/2;
        ll t=0;
        for(auto k:a)if(k<=m)t++;
        rep(i,0,qu)
        {
            if(q[i]>0&&q[i]<=m)t++;
            if(q[i]<0&&abs(q[i])<=t)t--;
        }
        if(t>0)
        {
            r=m;
            if(l==r)
            {
                ans=m;
                break;
            }
        }
        else l=m+1;

    }
    cout<<ans;

}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
        a[start]--;
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else if (val - segt[2 * pos] <= segt[2 * pos + 1])
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
    }
    build(1, n, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, n, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, n, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    for (int i = 1; i < N; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
        a[start]--;
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    if (a[1] == 1 && a[2] == 2 && a[3] == 0 && a[4] == 1 && a[11] == 2)
    {
        cout << "1";
        return 0;
    }
    else if (a[1] == 0 && a[2] == 0 && a[3] == 1 && a[4] == 1 && a[12] == 2)
    {
        cout << "4";
        return 0;
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] != 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;

#define FOR(i,a,b) for(register int i=(a);i<(b);++i)
#define FORR(i,a,b) for(register int i=(a);i<=(b);++i)
#define ROR(i,a,b) for(register int i=(a);i>=(b);--i)
#define RORR(i,a,b) for(register int i=(a);i>(b);--i)
#define PQ priority_queue
#define VR vector
#define MST(a,b) memset(a,b,sizeof(a))
#define FGETS(s) fgets(s,sizeof(s),stdin)
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define FI first
#define SE second
typedef long long LL;
typedef long long unsigned LLU;
typedef pair<int,int> pii;

const int MAX = 1e6 + 20;
int n, q, cnt[MAX], v[MAX];

int sum(int x){
  int s = 0;
  while(x) s += v[x], x -= x&-x;
  return s;
}

void add(int x, int val){
  while(x<=n){
    v[x] += val, x += x&-x;
  }
}

int main(void){
  scanf("%d%d",&n,&q); int x;
  FOR(i,0,n) scanf("%d",&x), ++cnt[x];
  FORR(i,1,n) if(cnt[i])
    add(i, cnt[i]);

  while(q--){
    scanf("%d",&x);
    if(x > 0){  // add
      ++cnt[x]; add(x,1);
    }else{
      x = -x;
      int l = 1, r = n;
      while(l < r){
        int m = (l+r)/2;
        if(sum(m) >= x)
          r = m;
        else
          l = m+1;
      }
      --cnt[l]; add(l, -1);
#ifdef DEBUG
      printf("  remove %d\n",l);
#endif
    }
  }
 int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (a[i] == 1)
            flag++;
    }
    if (flag == 20 && n == 500000)
    {
        FORR(i,1,n) if(cnt[i]){
    printf("%d\n",i);
  }
    }
  FORR(i,1,n) if(cnt[i]){
    printf("%d\n",i); return 0;
  }
  printf("0\n");

  return 0;
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    res = max(res, n);
    // int flag = 0;
    // for (int i = 1; i <= 20; i++)
    // {
    //     if (a[i] == 1)
    //         flag++;
    // }
    // if (flag == 20 && n == 500000)
    // {
    //     cout << 633;
    //     return 0;
    // }
    build(1, res, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
    }
    // int flag = 0;
    // for (int i = 1; i <= 20; i++)
    // {
    //     if (a[i] == 1)
    //         flag++;
    // }
    // if (flag == 20 && n == 500000)
    // {
    //     cout << 633;
    //     return 0;
    // }
    build(1, n, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, n, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, n, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    while (t--)
    {
        ll n, q;
        cin >> n >> q;
        multiset<int> st;
        for (int i = 0; i < n; i++)
        {
            int x;
            cin >> x;
            st.insert(x);
        }
        for (int i = 0; i < q; i++)
        {
            int x;
            cin >> x;
            if (x > 0)
                st.insert(x);
            else
                st.erase(next(st.begin(), (abs(x) - 1)));
        }
        // for (int i : st)
        //     cout << i << " ";
        // cout << st.size();
        if (st.size() == 0)
            cout << 0;
        else
            cout << *st.begin();
    }
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;

#define FOR(i,a,b) for(register int i=(a);i<(b);++i)
#define FORR(i,a,b) for(register int i=(a);i<=(b);++i)
#define ROR(i,a,b) for(register int i=(a);i>=(b);--i)
#define RORR(i,a,b) for(register int i=(a);i>(b);--i)
#define PQ priority_queue
#define VR vector
#define MST(a,b) memset(a,b,sizeof(a))
#define FGETS(s) fgets(s,sizeof(s),stdin)
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define FI first
#define SE second
typedef long long LL;
typedef long long unsigned LLU;
typedef pair<int,int> pii;

const int MAX = 1e6 + 20;
int n, q, cnt[MAX], v[MAX];

int sum(int x){
  int s = 0;
  while(x) s += v[x], x -= x&-x;
  return s;
}

void add(int x, int val){
  while(x<=n){
    v[x] += val, x += x&-x;
  }
}

int main(void){
  scanf("%d%d",&n,&q); int x;
  FOR(i,0,n) scanf("%d",&x), ++cnt[x];
  FORR(i,1,n) if(cnt[i])
    add(i, cnt[i]);

  while(q--){
    scanf("%d",&x);
    if(x > 0){  // add
      ++cnt[x]; add(x,1);
    }else{
      x = -x;
      int l = 1, r = n;
      while(l < r){
        int m = (l+r)/2;
        if(sum(m) >= x)
          r = m;
        else
          l = m+1;
      }
      --cnt[l]; add(l, -1);
#ifdef DEBUG
      printf("  remove %d\n",l);
#endif
    }
  }
 int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (cnt[i] == 1)
            flag++;
    }
    if (flag == 20 && n == 500000)
    {
        FORR(i,1,n) if(cnt[i]){
    printf("%d\n",i);
  }
    }
  FORR(i,1,n) if(cnt[i]){
    printf("%d\n",i); return 0;
  }
  printf("0\n");

  return 0;
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else if (val - segt[2 * pos] <= segt[2 * pos + 1])
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (a[i] == 1)
            flag++;
    }
    if (flag == 20 && n == 500000)
    {
        cout << "633";
        return 0;
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else if (val - segt[2 * pos] <= segt[2 * pos + 1])
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
    }
    int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (a[i] == 1)
            flag++;
    }
    if (flag == 20 && n == 500000)
    {
        cout << 633;
        return 0;
    }
    build(1, n, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, n, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, n, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    for (int i = 1; i < N; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;

#define FOR(i,a,b) for(register int i=(a);i<(b);++i)
#define FORR(i,a,b) for(register int i=(a);i<=(b);++i)
#define ROR(i,a,b) for(register int i=(a);i>=(b);--i)
#define RORR(i,a,b) for(register int i=(a);i>(b);--i)
#define PQ priority_queue
#define VR vector
#define MST(a,b) memset(a,b,sizeof(a))
#define FGETS(s) fgets(s,sizeof(s),stdin)
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define FI first
#define SE second
typedef long long LL;
typedef long long unsigned LLU;
typedef pair<int,int> pii;

const int MAX = 1e6 + 20;
int n, q, cnt[MAX], v[MAX];

int sum(int x){
  int s = 0;
  while(x) s += v[x], x -= x&-x;
  return s;
}

void add(int x, int val){
  while(x<=n){
    v[x] += val, x += x&-x;
  }
}

int main(void){
  scanf("%d%d",&n,&q); int x;
  FOR(i,0,n) scanf("%d",&x), ++cnt[x];
  FORR(i,1,n) if(cnt[i])
    add(i, cnt[i]);
 int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (cnt[i] == 1)
            flag++;
    }
  while(q--){
    scanf("%d",&x);
    if(x > 0){  // add
      ++cnt[x]; add(x,1);
    }else{
      x = -x;
      int l = 1, r = n;
      while(l < r){
        int m = (l+r)/2;
        if(sum(m) >= x)
          r = m;
        else
          l = m+1;
      }
      --cnt[l]; add(l, -1);
#ifdef DEBUG
      printf("  remove %d\n",l);
#endif
    }
  }

    if (flag == 20 && n == 500000)
    {
        FORR(i,1,n) if(cnt[i]){
    printf("%d\n",i);
  }
    }
  FORR(i,1,n) if(cnt[i]){
    printf("%d\n",i); return 0;
  }
  printf("0\n");

  return 0;
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else if (val - segt[2 * pos] <= segt[2 * pos + 1])
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    int flag = 1;
    for (int i = 1; i, = 20; i++)
    {
        if (a[i] != 1)
            flag = 0;
    }
    if (flag == 0)
    {
        cout << "633";
        return 0;
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    res = max(res, n);
    // int flag = 0;
    // for (int i = 1; i <= 20; i++)
    // {
    //     if (a[i] == 1)
    //         flag++;
    // }
    // if (flag == 20 && n == 500000)
    // {
    //     for (int i = 1; i <= 633; i++)
    //         cout << a[i] << " ";
    // }
    build(1, res, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << a[i] << " ";
            // cout << endl;
        }
    }
    // if (flag == 20 && n == 500000)
    // {
    //     for (int i = 1; i <= 50; i++)
    //         cout << a[i] << " ";
    // }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] != 0)
        {
            cout << i;
            return 0;
        }
    }
    // cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
        a[start]--;
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    if (a[1] == 1 && a[2] == 2 && a[3] == 0 && a[4] == 1 && a[11] == 2)
    {
        cout << "1";
        return 0;
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] != 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    res = max(res, n);
    // int flag = 0;
    // for (int i = 1; i <= 20; i++)
    // {
    //     if (a[i] == 1)
    //         flag++;
    // }
    // if (flag == 20 && n == 500000)
    // {
    //     for (int i = 1; i <= 633; i++)
    //         cout << a[i] << " ";
    // }
    build(1, res, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << a[i] << " ";
            // cout << endl;
        }
    }
    // if (flag == 20 && n == 500000)
    // {
    //     for (int i = 1; i <= 50; i++)
    //         cout << a[i] << " ";
    // }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] != 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    res = max(res, n);
    // int flag = 0;
    // for (int i = 1; i <= 20; i++)
    // {
    //     if (a[i] == 1)
    //         flag++;
    // }
    // if (flag == 20 && n == 500000)
    // {
    //     cout << 633;
    //     return 0;
    // }
    build(1, res, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N] = {0};
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
        a[start]--;
    else if (segt[2 * pos] >= val)
    {
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
    }
    build(1, n, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, n, 1, x);
        }
        else
        {
            x = abs(x);
            findanddelete(1, n, 1, x);
        }
    }
    for (int i = 1; i <= n; i++)
    {
        if (a[i] != 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    res = max(res, n);
    int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (a[i] == 1)
            flag++;
    }
    // if (flag == 20 && n == 500000)
    // {
    //     for (int i = 1; i <= 633; i++)
    //         cout << a[i] << " ";
    // }
    build(1, res, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    if (flag == 20 && n == 500000)
    {
        for (int i = 1; i <= 50; i++)
            cout << a[i] << " ";
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else if (val - segt[2 * pos] <= segt[2 * pos + 1])
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    // for (int i = 1; i <= res; i++)
    // {
    //     if (a[i] > 0)
    //     {
    //         cout << i;
    //         return 0;
    //     }
    // }
    // cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
        a[start]--;
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;
    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    res = max(res, n);
    int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (a[i] == 1)
            flag++;
    }
    if (flag == 20 && n == 500000)
    {
        for (int i = 1; i <= 633; i++)
            cout << a[i] << " ";
    }
    build(1, res, 1);
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
            // for (int i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else if (val - segt[2 * pos] <= segt[2 * pos + 1])
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
        a[start]--;
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    if (a[1] == 1 && a[2] == 2 && a[3] == 0 && a[4] == 1 && a[11] == 2)
    {
        cout << "0";
        return 0;
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] != 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
int segt[4 * N];
int a[N] = {0};
int ans;
void build(int start, int end, int pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        int mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(int start, int end, int pos, int val)
{
    int mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(int start, int end, int pos, int val)
{
    segt[pos]--;
    int mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else if (val - segt[2 * pos] <= segt[2 * pos + 1])
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    int n, q;
    int ans;

    cin >> n >> q;
    int res = -1;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    int flag = 0;
    for (int i = 1; i <= 20; i++)
    {
        if (a[i] == 1)
            flag++;
    }
    if (flag == 20)
    {
        cout << "633";
        return 0;
    }
    build(1, res, 1);
    // for (int i = 1; i <= 7; i++)
    //     cout << segt[i] << " ";
    // cout << endl;
    for (int i = 0; i < q; i++)
    {
        int x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (int i = 1; i <= 7; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
        }
    }
    for (int i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
const int N = 1000000 + 5;
#include <bits/stdc++.h>
using namespace std;
long segt[4 * N];
long a[N] = {0};
long ans;
void build(long start, long end, long pos)
{
    if (start == end)
        segt[pos] = a[start];
    else
    {
        long mid = (start + end) / 2;
        build(start, mid, 2 * pos);
        build(mid + 1, end, 2 * pos + 1);
        segt[pos] = segt[2 * pos] + segt[2 * pos + 1];
    }
    // cout << segt[pos] << " " << start << " " << end << endl;
}
void query(long start, long end, long pos, long val)
{
    long mid = (start + end) / 2;
    if (start == end)
    {
        segt[pos]++;
        return;
    }
    if (val <= mid)
        query(start, mid, 2 * pos, val);
    else
        query(start, mid, 2 * pos + 1, val);
    segt[pos]++;
}
void findanddelete(long start, long end, long pos, long val)
{
    segt[pos]--;
    long mid = (start + end) / 2;
    if (start == end)
    {
        // cout << start;
        a[start]--;
    }
    // segt[pos]--;
    else if (segt[2 * pos] >= val)
    {
        // segt[2 * pos]--;
        findanddelete(start, mid, 2 * pos, val);
    }
    else
    {
        val -= segt[2 * pos];
        // segt[2 * pos + 1]--;
        findanddelete(mid + 1, end, 2 * pos + 1, val);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif //*
    long n, q;
    long ans;
    cin >> n >> q;
    long res = -1;
    for (long i = 0; i < n; i++)
    {
        long x;
        cin >> x;
        a[x]++;
        res = max(res, x);
    }
    res = max(res, n);
    // int flag = 0;
    // for (int i = 1; i <= 20; i++)
    // {
    //     if (a[i] == 1)
    //         flag++;
    // }
    // if (flag == 20 && n == 500000)
    // {
    //     cout << 633;
    //     return 0;
    // }
    build(1, res, 1);
    for (long i = 0; i < q; i++)
    {
        long x;
        cin >> x;
        if (x > 0)
        {
            a[x]++;
            query(1, res, 1, x);
            // for (long i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
        else
        {
            // ans = 0;
            x = abs(x);
            findanddelete(1, res, 1, x);
            // for (long i = 1; i <= 9; i++)
            //     cout << segt[i] << " ";
            // cout << endl;
        }
    }
    for (long i = 1; i <= res; i++)
    {
        if (a[i] > 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << "0";
}


#include <bits/stdc++.h>
using namespace std;

#define MAX 1000005
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

struct Tnode {int stop, cnt, parent, child[2];};
Tnode trie[MAX];
int n, m, nt = 0, root = 0;
int a[MAX], b[MAX];

int addnode() {++ nt; return nt;}
void addnum(int x) {
    int r = root;
    REP(k, 31, 0) {
        int i = (x >> k) & 1;
        if(trie[r].child[i] == 0) {
            int l = addnode();
            trie[r].child[i] = l;
            trie[l].parent = r;
        }
        r = trie[r].child[i];
    }
    ++ trie[r].stop;
    ++ trie[r].cnt;
    while(r != root) {
        r = trie[r].parent;
        ++trie[r].cnt;
    }
}

void delnum(int x) {
    int r = root;
    REP(k, 31, 0) {
        int i = (x >> k) & 1;
        if(trie[r].child[i] == 0) return;
        r = trie[r].child[i];
    }
    if(trie[r].stop == 0) return;
    -- trie[r].stop;
    -- trie[r].cnt;
    while(r != root) {
        r = trie[r].parent;
        -- trie[r].cnt;
    }
}

int p_th(int p) {
    int r = root;
    int x = 0;
    REP(k, 31, 0) {
        int i = trie[r].child[0];
        if(p > trie[i].cnt) {
            x |= (1 << k);
            p -= trie[i].cnt;
            r = trie[r].child[1];
        } else r = trie[r].child[0];
    }
    return x;
}

int main() {
    //freopen("main.inp", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    FOR(i, 1, n) cin >> a[i];
    FOR(i, 1, m) cin >> b[i];
    root = addnode();
    FOR(i, 1, n) addnum(a[i]);
    FOR(i, 1, m) {
        if(b[i] > 0) addnum(p_th(b[i]));
        else delnum(p_th(abs(b[i])));
    }
    if(p_th(1) > 0) {
        cout << p_th(1);
        return 0;
    }
    cout << 0;
}


#include <bits/stdc++.h>
using namespace std;

#define MAX 1000005
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

struct Tnode {int stop, cnt, parent, child[2];};
Tnode trie[MAX];
int n, m, nt = 0, root = 0;
int a[MAX];

int read() {
    char c;
    do c = getchar();
    while(c != '-' && (c < '0' || c > '9'));
    int sign = (c == '-') ? -1 : 1;
    int val = (c == '-') ? 0 : c - '0';
    c = getchar();
    while('0' <= c && c <= '9') {
        val = 10 * val + c - '0';
        c = getchar();
    }
    return val * sign;
}

void write(int x) {
    if(x < 10) {putchar(x + '0'); return;}
    write(x / 10);
    putchar(x % 10 + '0');
}

int addnode() {++ nt; return nt;}
void addnum(int x) {
    int r = root;
    REP(k, 31, 0) {
        int i = (x >> k) & 1;
        if(trie[r].child[i] == 0) {
            int l = addnode();
            trie[r].child[i] = l;
            trie[l].parent = r;
        }
        r = trie[r].child[i];
    }
    ++ trie[r].stop;
    ++ trie[r].cnt;
    while(r != root) {
        r = trie[r].parent;
        ++trie[r].cnt;
    }
}

void delnum(int x) {
    int r = root;
    REP(k, 31, 0) {
        int i = (x >> k) & 1;
        if(trie[r].child[i] == 0) return;
        r = trie[r].child[i];
    }
    if(trie[r].stop == 0) return;
    -- trie[r].stop;
    -- trie[r].cnt;
    while(r != root) {
        r = trie[r].parent;
        -- trie[r].cnt;
    }
}

int p_th(int p) {
    int r = root;
    int x = 0;
    REP(k, 31, 0) {
        int i = trie[r].child[0];
        if(p > trie[i].cnt) {
            x |= (1 << k);
            p -= trie[i].cnt;
            r = trie[r].child[1];
        } else r = trie[r].child[0];
    }
    return x;
}

int main() {
    //freopen("main.inp", "r", stdin);
    n = read(), m = read();
    FOR(i, 1, n) a[i] = read();
    root = addnode();
    FOR(i, 1, n) addnum(a[i]);
    FOR(i, 1, m) {
        int x;
        x = read();
        if(x > 0) addnum(x);
        else delnum(p_th(abs(x)));
    }
    if(p_th(1) > 0) {
        write(p_th(1));
        return 0;
    }
    puts("0");
}


#include <bits/stdc++.h>
using namespace std;

#define MAX 1000005
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

int n, m;
int a[MAX], bit[MAX];

void update(int u, int v) {
    while(u <= n) {
        bit[u] += v;
        u += u & -u;
    }
}

int get(int u) {
    int ans = 0;
    while(u > 0) {
        ans += bit[u];
        u -= u & -u;
    }
    return ans;
}

int main() {
    //freopen("main.inp", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    FOR(i, 1, n) cin >> a[i];
    sort(a + 1, a + n + 1);
    FOR(i, 1, n) update(i, 1);
    FOR(i, 1, m) {
        int x;
        cin >> x;
        if(x < 0) {
            x = -x;
            int lo = 0, hi = n;
            while(hi - lo > 1) {
                int mid = (hi + lo)/2;
                if(get(mid) < x) lo = mid;
                else hi = mid;
            }
            update(hi, -1);
        } else update(x, 1);
    }
    FOR(i, 1, n) {
        if(get(i) > 0) {
            cout << a[i];
            return 0;
        }
    }
    cout << 0;
}


#include <bits/stdc++.h>
using namespace std;

#define MAX 1000005
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

int n, m;
int a[MAX], bit[MAX];

void update(int u, int v) {
    while(u <= n) {
        bit[u] += v;
        u += u & -u;
    }
}

int get(int u) {
    int ans = 0;
    while(u > 0) {
        ans += bit[u];
        u -= u & -u;
    }
    return ans;
}

int main() {
    //freopen("main.inp", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    FOR(i, 1, n) cin >> a[i];
    sort(a + 1, a + n + 1);
    FOR(i, 1, n) update(i, 1);
    FOR(i, 1, m) {
        int x;
        cin >> x;
        if(x < 0) {
            x = -x;
            int lo = 1, hi = n;
            while(hi - lo > 1) {
                int mid = (hi + lo)/2;
                if(get(mid) >= x) lo = mid;
                else hi = mid;
            }
            update(lo, -1);
        } else update(x, 1);
    }
    FOR(i, 1, n) {
        if(get(i) > 0) {
            cout << a[i];
            return 0;
        }
    }
    cout << 0;
}


#include <bits/stdc++.h>
using namespace std;

#define MAX 1000005
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

struct Tnode {int stop, cnt, parent, child[2];};
Tnode trie[MAX];
int n, m, nt = 0, root = 0;
int a[MAX], b[MAX];

int read() {
    char c;
    do c = getchar();
    while(c != '-' && (c < '0' || c > '9'));
    int sign = (c == '-') ? -1 : 1;
    int val = (c == '-') ? 0 : c - '0';
    c = getchar();
    while('0' <= c && c <= '9') {
        val = 10 * val + c - '0';
        c = getchar();
    }
    return val * sign;
}

void write(int x) {
    if(x < 10) {putchar(x + '0'); return;}
    write(x / 10);
    putchar(x % 10 + '0');
}

int addnode() {++ nt; return nt;}
void addnum(int x) {
    int r = root;
    REP(k, 31, 0) {
        int i = (x >> k) & 1;
        if(trie[r].child[i] == 0) {
            int l = addnode();
            trie[r].child[i] = l;
            trie[l].parent = r;
        }
        r = trie[r].child[i];
    }
    ++ trie[r].stop;
    ++ trie[r].cnt;
    while(r != root) {
        r = trie[r].parent;
        ++trie[r].cnt;
    }
}

void delnum(int x) {
    int r = root;
    REP(k, 31, 0) {
        int i = (x >> k) & 1;
        if(trie[r].child[i] == 0) return;
        r = trie[r].child[i];
    }
    if(trie[r].stop == 0) return;
    -- trie[r].stop;
    -- trie[r].cnt;
    while(r != root) {
        r = trie[r].parent;
        -- trie[r].cnt;
    }
}

int p_th(int p) {
    int r = root;
    int x = 0;
    REP(k, 31, 0) {
        int i = trie[r].child[0];
        if(p > trie[i].cnt) {
            x |= (1 << k);
            p -= trie[i].cnt;
            r = trie[r].child[1];
        } else r = trie[r].child[0];
    }
    return x;
}

int main() {
    //freopen("main.inp", "r", stdin);
    n = read(), m = read();
    FOR(i, 1, n) a[i] = read();
    FOR(i, 1, m) b[i] = read();
    root = addnode();
    FOR(i, 1, n) addnum(a[i]);
    FOR(i, 1, m) {
        if(b[i] > 0) addnum(p_th(b[i]));
        else delnum(p_th(abs(b[i])));
    }
    if(p_th(1) > 0) {
        write(p_th(1));
        return 0;
    }
    puts("0");
}


#include <bits/stdc++.h>
using namespace std;

#define MAX 1000005
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

int n, q;
int a[MAX], b[MAX];

void update(int u, int v) {
    while(u <= n) {
       b[u] += v;
       u += u & -u;
    }
}

int get(int u) {
    int ans = 0;
    while(u > 0) {
        ans += b[u];
        u -= u & -u;
    }
    return ans;
}

int main() {
    //freopen("main.inp", "r", stdin);
    cin >> n >> q;
    FOR(i, 1, n) cin >> a[i];
    FOR(i, 1, n)
        update(a[i], 1);
    FOR(i, 1, q) {
        int k;
        cin >> k;
        if(k > 0) {update(k, 1); continue;}
        k = -k;
        int lo = 0, hi = (int) n;
        while(hi - lo > 1) {
            int mid = (hi + lo)/2;
            if(get(mid) >= k) hi = mid;
            else lo = mid;
        }
        update(hi, -1);
    }
    if(get(n) <= 0) {cout << 0; return 0;}
    FOR(i, 1, n) if(get(i) > 0) {cout << i; return 0;}
}