import java.util.*;
import java.io.*;

public class File {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // We can do the queries in O(1)
        // Precompute the range sums of a values.
        // Range sum of x just use the SUM formula.

        int n = sc.nextInt();
        int S = sc.nextInt();

        long[] total = new long[n];
        long currSum = 0;

        for (int i = 0; i < n; i++) {
            currSum += sc.nextInt();
            total[i] = currSum;
        }

        int lo = 1;
        int hi = n;
        int numSouvenirs = 0;
        long minCost = Long.MAX_VALUE;

        while (lo <= hi) {
            int k = lo + (hi - lo) / 2;

            long cost = find(total, k, S);

            if (cost == -1) {
                hi = k - 1;
            }
            else if (k > numSouvenirs) {
                numSouvenirs = k;
                minCost = cost;

                lo = k + 1;
            }
            else {
                lo = k + 1;
            }
        }

        if (numSouvenirs == 0) {
            System.out.println(0 + " " + 0);
        }
        else {
            System.out.println(numSouvenirs + " " + minCost);
        }
    }

    // Return the minimum cost of getting k souvenirs.
    public static long find(long[] total, int k, int S) {
        long minCost = Long.MAX_VALUE;

        for (int i = 0; i + k <= total.length; i++) {
            int N = i + k;
            long cost = getSum(N);

            if (N - k >= 1) {
                cost -= getSum(N-k);
            }

            long part1 = cost * k;
            long part2 = (total[i+k-1] - (i > 0 ? total[i-1] : 0));

            if ((part1 + part2) <= S) {
                minCost = Math.min(minCost, part1 + part2);
            }
        }

        return minCost == Long.MAX_VALUE ? -1 : minCost;
    }

    public static long getSum(long N) {
        return (N * (N + 1)) / 2;
    }
}


import java.util.*;
import java.io.*;

public class File {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int S = sc.nextInt();

        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int maxSou = 0;
        int minCost = 0;

        int lo = 1;
        int hi = n;

        while (lo <= hi) {
            int k = lo + (hi - lo) / 2;
            int cost = canMake(a, k, S);

            if (cost == -1) {
                hi = k - 1;
            }
            else {
                if (k > maxSou) {
                    maxSou = k;
                    minCost = cost;
                }

                lo = k + 1;
            }
        }

        System.out.println(maxSou + " " + minCost);
    }

    public static int canMake(int[] a, int k, int S) {
        long[] costs = new long[a.length];
        for (int i = 0; i < a.length; i++) {
            costs[i] = a[i] + (i+1) * (long)k;
        }

        Arrays.sort(costs);
        long cost = 0;
        for (int i = 0; i < k; i++) {
            cost += costs[i];
        }

        if (cost <= S) {
            return (int)cost;
        }
        else {
            return -1;
        }
    }
}


import java.io.*;
import java.util.*;

public class Main {
    private static FastReader f = new FastReader();
    private static int[] arr;
    private static int[] calcArr;
    private static int n;

    public static void main(String[] args) {
        n = f.nextInt();
        int s = f.nextInt();
        arr = new int[n];
        calcArr = new int[n];

        for(int i=0;i<n;i++) {
            arr[i] = f.nextInt();
        }

        int left = 0;
        int right = n;

        while (left < right) {
            int mid = left + (right-left) / 2;

            if(calc(mid) < s) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }

        if(calc(left) > s) {
            left--;
        }
        System.out.println(left+" "+calc(left));
    }

    private static long calc(int k) {
        for(int i=0;i<n;i++) {
            calcArr[i] = k * (i+1) + arr[i];
        }

        Arrays.sort(calcArr);

        long sum = 0;
        for(int i=0;i<k;i++) {
            sum += calcArr[i];
        }
        return sum;
    }

    //fast input reader
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.*;
import java.util.*;

public class Main {
    private static FastReader f = new FastReader();
    private static int[] arr;
    private static long[] calcArr;
    private static int n;

    public static void main(String[] args) {
        n = f.nextInt();
        int s = f.nextInt();
        arr = new int[n];
        calcArr = new long[n];

        for(int i=0;i<n;i++) {
            arr[i] = f.nextInt();
        }

        int left = 0;
        int right = n;

        while (left < right) {
            int mid = left + (right-left) / 2;

            if(calc(mid) < s) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }

        if(calc(left) > s) {
            left--;
        }
        System.out.println(left+" "+calc(left));
    }

    private static long calc(int k) {
        for(long i=0;i<n;i++) {
            calcArr[(int)i] = k * (i+1) + ((long)(arr[(int)i]));
        }

        Arrays.sort(calcArr);

        long sum = 0;
        for(int i=0;i<k;i++) {
            sum += calcArr[i];
        }
        return sum;
    }

    //fast input reader
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class SagheerAndNubianMarket {

    public static Integer[] costs;
    public static int maxItems = 0;
    public static int minCost = 0;

    public static Integer[] run(int k) {
        Integer[] array = new Integer[costs.length];
        for (int i=0; i<costs.length; i++)
            array[i] = costs[i] + ((i+1) * k);
        Arrays.sort(array);
        return array;
    }

    public static boolean isMax(int k, int s) {
        int items = 0;
        int cost = 0;
        Integer[] array = run(k);
        for (int i=0; i<k; i++) {
            if ((cost + array[i]) <= s) {
                items++;
                cost += array[i];
            }
            else
                break;
        }
        if (items > maxItems) {
            maxItems = items;
            minCost = cost;
            return true;
        }
        return false;
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int s = sc.nextInt();
        costs = new Integer[n];
        for (int i=0; i<n; i++)
            costs[i] = sc.nextInt();
        int l = 1;
        int h = n;
        while (l <= h) {
            int mid = (l + h) / 2;
            if (isMax(mid,s))
                l = mid + 1;
            else
                h = mid - 1;
        }
        pw.println(maxItems + " " + minCost);
        pw.flush();
        pw.close();
    }

}

class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}
}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class SagheerAndNubianMarket {

    public static Integer[] costs;
    public static int maxItems = 0;
    public static int minCost = 0;

    public static Integer[] run(int k) {
        Integer[] array = new Integer[costs.length];
        for (int i=0; i<costs.length; i++)
            array[i] = costs[i] + ((i+1) * k);
        Arrays.sort(array);
        return array;
    }

    public static boolean isMax(int k, int s) {
        int items = 0;
        int cost = 0;
        Integer[] array = run(k);
        for (int i=0; i<k; i++) {
            if ((cost + array[i]) <= s) {
                items++;
                cost += array[i];
            }
            else
                return false;
        }
        if (items > maxItems) {
            maxItems = items;
            minCost = cost;
            return true;
        }
        return false;
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int s = sc.nextInt();
        costs = new Integer[n];
        for (int i=0; i<n; i++)
            costs[i] = sc.nextInt();
        int l = 1;
        int h = n;
        while (l <= h) {
            int mid = (l + h) / 2;
            if (isMax(mid,s))
                l = mid + 1;
            else
                h = mid - 1;
        }
        pw.println(maxItems + " " + minCost);
        pw.flush();
        pw.close();
    }

}

class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}
}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));
}}

int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

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

		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(ft[i]>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));
}}

int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

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

		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(ft[i]>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));
}}

int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

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

		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=0;

			for(int i=1;i<=n;i++){
		if(ft[i]>0){
			cout<<i;ans=1;
			break;
		}
			}
    if(ans==0)cout<<0;
}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));
}}

int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){
	 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(ft[i]>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));

}}
int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}
	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+1<<i <=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){
	 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(ft[i]>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));

}}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){

	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
	y[a]++;}

	// building fenwick tree
	for(int i=1;i<=n;i++){
		update(y[i],i);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		y[x]++;
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);

		y[num]--;
				update(-1,num);
		}
	}

	int ans=0;
		for(int i=1;i<=n;i++){
			if(y[i]>0){
			ans=i;
				break;
			}}
			cout<<ans;}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));

}}
int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}
	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+1<<i <=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){

	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(ft[i]>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));

}}
int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}
	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+1<<i <=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){
	 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(sum(i)>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));
}}

int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){
	 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(sum(i)>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));
}}

int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

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

		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=0;

			for(int i=1;i<=n;i++){
		if(ft[i]>0){
			cout<<i;ans=1;
			break;
		}
			}
    if(ans==0)cout<<0;
}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));

}}
int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}
	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr +1<<i <=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){

	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(sum(i)>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001];
void update(int add,int i){
while(i<=1000000){
ft[i]+=add;
	i+=(i&(-i));
}}

int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=19;i>=0 && curr+(1<<i)<=1000000;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){
	 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=1000000;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(sum(i)>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));

}}
int sum(int i){
	int s=0;
	while(i>0){
		s+=ft[i];
		i=i-(i&(-i));
	}
	return s;
}
	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){

	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);
				update(-1,num);
		}
	}

	int ans=sum(n);
	if(!ans)cout<<0;
	else{
			for(int i=1;i<=n;i++){
		if(sum(i)>0){
			cout<<i;
			break;
		}
			}}
	}


#include<bits/stdc++.h>
using namespace std;
	int ft[1000001],n;
void update(int add,int i){
while(i<=n){
ft[i]+=add;
	i+=(i&(-i));

}}

	int find (int k){
		int curr=0,prevsum=0;
		for(int i=log2(n);i>=0 && curr+(1<<i)<=n;i--){
			if(ft[curr+(1<<i)]+prevsum<k){
				curr=curr+(1<<i);

				prevsum+=ft[curr];
			}
		}
		return curr+1;
	}

int main(){

	cin>>n;int q;cin>>q;
		int y[n+1]={0};
		//count of numbers
	for(int i=1;i<=n;i++){
		int a;
	cin>>a;
		// building fenwick tree
		update(1,a);
	y[a]++;}

	for(int i=1;i<=q;i++){
		int x; cin>>x;

		if(x>0){
		y[x]++;
		update(1,x);
	}

		else{x=abs(x);
		int num= find(x);

		y[num]--;
				update(-1,num);
		}
	}

	int ans=0;
		for(int i=1;i<=n;i++){
			if(y[i]>0){
			ans=i;
				break;
			}}
			cout<<ans;}


/* EK BAAR AUR */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
/*
ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/

//ll cnt;
/*void bfs(ll x,ll vis[],vector<ll> v[])
{
    for(auto i:v[x])
    {
        if(!vis[i])
        {
            vis[i]=1;
            cnt++;
            bfs(i,vis,v);
        }
    }
}*/
ll getsum(ll tree[],ll index)
{
    index++;
    ll sum=0;
    while(index>0)
    {
        sum+=tree[index];
        index-=(index&-index);
    }
    return sum;
}
void update(ll tree[],ll index,ll value,ll n)
{
    index++;
    while(index<=n)
    {
        tree[index]+=value;
        index+=(index&-index);
    }
}
ll *buildtree(ll n,ll a[])
{
    ll *tree=new ll[n+1];
    for(ll i=0;i<n;i++)
    tree[i]=0;
    for(ll i=0;i<n;i++)
    {
        update(tree,i,a[i],n);
    }
    return tree;
}
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll a[n];
    mem0(a);
    loop(i,0,n-1)
    {
        cin>>x;
        x--;
        a[x]++;
    }
    ll *tree=buildtree(n,a);
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            update(tree,x-1,1,n);
        }
        else
        {
            ll l=0;
            x*=-1;
            ll r=n-1;
            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=getsum(tree,mid);
                if(y>x)
                {
                    r=mid;
                }
                else if(x<y)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }

            }
            if(getsum(tree,l)>=x)
            {
                r=l;
            }
            update(tree,r,-1,n);
        }
    }
    if(getsum(tree,n-1)==0)
    cout<<0;
    else
    {
    for(ll i=0;i<n;i++)
    {
        if(getsum(tree,i)>0)
        {cout<<i+1;
        break;}
    }

    }
    return 0;
}


/* NEVER GIVE UP */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
/*ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}

ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/
const ll Z=100005;
ll tree[((ll)Z<<2)+10];

ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)// complete overlap
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]+=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]+tree[2*index+1];
    return ;
}

int main()
{
    ll n,q,x;
    cin>>n>>q;
    loop(i,1,n)//={1,2,3,4,5,60};
    {
        cin>>x;
        updatenode(tree,1,1,n,x,1);
    }
    ll index=1;
    ll start=1;
    ll end=n;
    //cout<<query(tree,1,1,n,1,n)<<endl;
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            updatenode(tree,1,1,n,x,1);
        }
        else
        {
            ll z=abs(x);
            ll l=1,r=n;

            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=query(tree,1,1,n,l,mid);
                if(y>z)
                {
                    r=mid;
                }
                else if(y<z)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }

            }

            if(query(tree,1,1,n,1,l)>=z)
            {
                updatenode(tree,1,1,n,l,-1);
            }
            else
            {
                updatenode(tree,1,1,n,r,-1);
            }
        }
     }

    // cout<<endl;
     for(ll i=1;i<=n;i++)
     {
         ll y=query(tree,1,1,n,1,i);
         if(y>0)
         {
             cout<<i;
             return 0;
         }
     }
     cout<<0;
    return 0;
}


/* NEVER GIVE UP */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
/*
ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/
void buildtree(ll *tree,ll *a,ll index,ll start,ll end)
{
    if(start>end)
    return ;
    if(start==end)
    {
        tree[index]=a[start];
        return;
    }
    ll mid=(start+end)/2;
    buildtree(tree,a,2*index,start,mid);
    buildtree(tree,a,2*index+1,mid+1,end);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)// complete overlap
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]+=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]+tree[2*index+1];
    return ;
}
/*
void updaterange(ll *tree,ll index,ll s,ll e,ll rs,ll re,ll val)
{
    if(rs>e||s>re)
    return ;
    if(s==e)
    {
        tree[index]=val;
        return ;
    }
    ll mid=(s+e)/2;
    updaterange(tree,2*index,s,mid,rs,re,val);
    updaterange(tree,2*index+1,mid+1,e,rs,re,val);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=min(left,right);
    return ;
}*/
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll a[n+1];
    mem0(a);
    loop(i,1,n)//={1,2,3,4,5,60};
    {
        cin>>x;
        a[x]++;
    }
    ll *tree=new ll[4*n+5];
    ll index=1;
    ll start=1;
    ll end=n;
    buildtree(tree,a,index,start,end);
    //cout<<query(tree,1,1,n,1,n)<<endl;
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            updatenode(tree,1,1,n,x,1);
        }
        else
        {
            ll z=abs(x);
            ll l=1,r=n;

            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=query(tree,1,1,n,l,mid);
                //cout<<l<<" "<<r<<" y "<<" "<<y<<" ";
                if(y>=z)
                {
                    r=mid;
                }
                else //if(y<z)
                {
                    l=mid;
                }

            }

            if(query(tree,1,1,n,1,l)>=z)
            {
      //          cout<<l<<" ";
                updatenode(tree,1,1,n,l,-1);
            }
            else
            {
        //        cout<<r<<" ";
                updatenode(tree,1,1,n,r,-1);
            }
            cout<<query(tree,1,1,n,1,n)<<endl;
        }
     }

    // cout<<endl;
     for(ll i=1;i<=n;i++)
     {
         ll y=query(tree,1,1,n,1,i);
         if(y>0)
         {
             cout<<i;
             return 0;
         }
     }
     cout<<0;
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

pair<int, bool> getNthElement(multiset<int> & searchSet, int n)
{
pair<int, bool> result;
if(searchSet.size() > n )
{
result.first = *(std::next(searchSet.begin(), n));
result.second = true;
}
else
result.second = false;
return result;
}
int main()
{
    int n,q,x;
    cin>>n>>q;
    multiset<int>s;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        s.insert(x);
    }
    for(int i=0;i<q;i++)
    {
        cin>>x;
        if(x>0)
        s.insert(x);
        else
        {
            int y=abs(x);
            pair<int, bool> result = getNthElement(s, y-1);
            int z=result.first;
            //cout<<z<<" ";
            s.erase(z);
        }
    }
    if(s.size()!=0)
    cout<<*(s.begin());
    else
    cout<<0;
    return 0;
}


/* NEVER GIVE UP */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
/*ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}

ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/
void buildtree(ll *tree,ll *a,ll index,ll start,ll end)
{
    if(start>end)
    return ;
    if(start==end)
    {
        tree[index]=a[start];
        return;
    }
    ll mid=(start+end)/2;
    buildtree(tree,a,2*index,start,mid);
    buildtree(tree,a,2*index+1,mid+1,end);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)// complete overlap
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]+=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]+tree[2*index+1];
    return ;
}
/*
void updaterange(ll *tree,ll index,ll s,ll e,ll rs,ll re,ll val)
{
    if(rs>e||s>re)
    return ;
    if(s==e)
    {
        tree[index]=val;
        return ;
    }
    ll mid=(s+e)/2;
    updaterange(tree,2*index,s,mid,rs,re,val);
    updaterange(tree,2*index+1,mid+1,e,rs,re,val);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=min(left,right);
    return ;
}*/
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll g=log2(n);
    ll a[n+1];
    mem0(a);
    loop(i,1,n)//={1,2,3,4,5,60};
    {
        cin>>x;
        a[x]++;
    }
    g++;
    ll *tree=new ll[(ll)(pow(2,g+1)+5.5)];
    ll index=1;
    ll start=1;
    ll end=n;
    buildtree(tree,a,index,start,end);
    //cout<<query(tree,1,1,n,1,n)<<endl;
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            updatenode(tree,1,1,n,x,1);
        }
        else
        {
            ll z=abs(x);
            ll l=1,r=n;

            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=query(tree,1,1,n,l,mid);
                //cout<<l<<" "<<r<<" y "<<" "<<y<<" ";
                if(y>z)
                {
                    r=mid;
                }
                else if(y<z)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }

            }

            if(query(tree,1,1,n,1,l)>=z)
            {
      //          cout<<l<<" ";
                updatenode(tree,1,1,n,l,-1);
            }
            else
            {
        //        cout<<r<<" ";
                updatenode(tree,1,1,n,r,-1);
            }
          //  cout<<query(tree,1,1,n,1,n)<<endl;
        }
     }

    // cout<<endl;
     for(ll i=1;i<=n;i++)
     {
         ll y=query(tree,1,1,n,1,i);
         if(y>0)
         {
             cout<<i;
             return 0;
         }
     }
     cout<<0;
    return 0;
}


/* NEVER GIVE UP */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
/*ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}

ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/

int getSum(int BITree[], int index)
{
    int sum = 0; // Iniialize result

    // index in BITree[] is 1 more than the index in arr[]
    index = index + 1;

    // Traverse ancestors of BITree[index]
    while (index>0)
    {
        // Add current element of BITree to sum
        sum += BITree[index];

        // Move index to parent node in getSum View
        index -= index & (-index);
    }
    return sum;
}

// Updates a node in Binary Index Tree (BITree) at given index
// in BITree. The given value 'val' is added to BITree[i] and
// all of its ancestors in tree.
void updateBIT(int BITree[], int n, int index, int val)
{
    // index in BITree[] is 1 more than the index in arr[]
    index = index + 1;

    // Traverse all ancestors and add 'val'
    while (index <= n)
    {
    // Add 'val' to current node of BI Tree
    BITree[index] += val;

    // Update index to that of parent in update View
    index += index & (-index);
    }
}

// Constructs and returns a Binary Indexed Tree for given
// array of size n.
int *constructBITree(int arr[], int n)
{
    // Create and initialize BITree[] as 0
    int *BITree = new int[n+1];
    for (int i=1; i<=n; i++)
        BITree[i] = 0;

    // Store the actual values in BITree[] using update()
    for (int i=0; i<n; i++)
        updateBIT(BITree, n, i, arr[i]);

    // Uncomment below lines to see contents of BITree[]
    //for (int i=1; i<=n; i++)
    //     cout << BITree[i] << " ";

    return BITree;
}

int mid;

int main(){
    FAST;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,q;
    cin >> n >> q;
    int a[n+1]={0},aa;
    loop(i,0,n-1){
        cin>>aa;
        a[aa]++;
    }
    int b;
    int *BITree = constructBITree(a, n+1);
    int l,r,mid;
    while(q--)
    {
        cin >> b;
        if(b>0){
            updateBIT(BITree, n+1, b, 1);
        }
        else
        {
            b*=-1;
            l=1,r=n;
            while(1)
            {
                if(r-l>1)
                {
                    mid=(l+r)/2;
                    if(getSum(BITree,mid)>=b)
                    {
                        r=mid;
                    }
                    else
                    {
                        l=mid;
                    }
                }
                else
                break;
            }
            if(getSum(BITree,l)>=b) r=l;
            updateBIT(BITree, n+1, r, -1);
        }
    }
    if( getSum(BITree, n)==0 )
    {
        cout << 0;
    }
    else
    {
        for(int i=1;i<=n;i++){
            if(getSum(BITree,i)){
               cout << i;
                return 0;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
/*
ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
//SEGMENT TREE
void buildtree(ll *tree,ll *a,ll index,ll start,ll end)
{
    if(start>end)
    return ;
    if(start==end)
    {
        tree[index]=a[start];
        return;
    }
    ll mid=(start+end)/2;
    buildtree(tree,a,2*index,start,mid);
    buildtree(tree,a,2*index+1,mid+1,end);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]^tree[2*index+1];
    ll x=log2(e-s+1);
    if(x%2==1)
    tree[index]=tree[2*index]|tree[2*index+1];
    else
    tree[index]=tree[2*index]^tree[2*index+1];

    return ;
}

void updaterange(ll *tree,ll index,ll s,ll e,ll rs,ll re,ll val)
{
    if(rs>e||s>re)
    return ;
    if(s==e)
    {
        tree[index]^=val;
        return ;
    }
    ll mid=(s+e)/2;
    updaterange(tree,2*index,s,mid,rs,re,val);
    updaterange(tree,2*index+1,mid+1,e,rs,re,val);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
*/
template< class InputIt, class Distance >
void advance( InputIt& it, Distance n );
void fun(ll a[],ll x,ll n)
{
    ll cnt=0;
    for(ll i=1;i<=n;i++)
    {
        cnt+=a[i];
        if(cnt>=x)
        {
            a[i]--;
            return ;
        }
    }
}
pair<int, bool> getNthElement(multiset<int> & searchSet, int n)
{
pair<int, bool> result;
if(searchSet.size() > n )
{
result.first = *(std::next(searchSet.begin(), n));
result.second = true;
}
else
result.second = false;
return result;
}
int main()
{
    int n,q,x;
    cin>>n>>q;
    multiset<int>s;
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        s.insert(x);
    }
    for(ll i=0;i<q;i++)
    {
        cin>>x;
        if(x>0)
        s.insert(x);
        else
        {
            int y=abs(x);
            pair<int, bool> result = getNthElement(s, y-1);
            int z=result.first;
            //cout<<z<<" ";
            s.erase(z);
        }
    }
    if(s.size()!=0)
    cout<<*(s.begin());
    else
    cout<<0;
    return 0;
}


// C++ code to demonstrate operations of Binary Index Tree
#include <iostream>

using namespace std;

/*		 n --> No. of elements present in input array.
	BITree[0..n] --> Array that represents Binary Indexed Tree.
	arr[0..n-1] --> Input array for which prefix sum is evaluated. */

// Returns sum of arr[0..index]. This function assumes
// that the array is preprocessed and partial sums of
// array elements are stored in BITree[].
int getSum(int BITree[], int index)
{
	int sum = 0; // Iniialize result

	// index in BITree[] is 1 more than the index in arr[]
	index = index + 1;

	// Traverse ancestors of BITree[index]
	while (index>0)
	{
		// Add current element of BITree to sum
		sum += BITree[index];

		// Move index to parent node in getSum View
		index -= index & (-index);
	}
	return sum;
}

// Updates a node in Binary Index Tree (BITree) at given index
// in BITree. The given value 'val' is added to BITree[i] and
// all of its ancestors in tree.
void updateBIT(int BITree[], int n, int index, int val)
{
	// index in BITree[] is 1 more than the index in arr[]
	index = index + 1;

	// Traverse all ancestors and add 'val'
	while (index <= n)
	{
	// Add 'val' to current node of BI Tree
	BITree[index] += val;

	// Update index to that of parent in update View
	index += index & (-index);
	}
}

// Constructs and returns a Binary Indexed Tree for given
// array of size n.
int *constructBITree(int arr[], int n)
{
	// Create and initialize BITree[] as 0
	int *BITree = new int[n+1];
	for (int i=1; i<=n; i++)
		BITree[i] = 0;

	// Store the actual values in BITree[] using update()
	for (int i=0; i<n; i++)
		updateBIT(BITree, n, i, arr[i]);

	// Uncomment below lines to see contents of BITree[]
	//for (int i=1; i<=n; i++)
	//	 cout << BITree[i] << " ";

	return BITree;
}

// Driver program to test above functions
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n,q;
  cin>>n>>q;

	int freq[n];// = {2, 1, 1, 3, 2, 3, 4, 5, 6, 7, 8, 9};
	//int n = sizeof(freq)/sizeof(freq[0]);
	int *BITree = constructBITree(freq, n);
//	cout << "Sum of elements in arr[0..5] is "
	//	<< getSum(BITree, 5);

	// Let use test the update operation
	//freq[3] += 6;
	while(q--)
    {
        int x;
      cin>>x;
        if(x>0)
        {
            update(tree,x-1,1,n);
        }
        else
        {
            int l=0;
            x*=-1;
            int r=n-1;
            while(r-l>1)
            {
                int mid=(l+r)/2;
                int y=getsum(tree,mid);
                if(y>x)
                {
                    r=mid;
                }
                else if(y<x)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }

            }
            if(getsum(tree,l)>=x)
            {
                r=l;
            }
            //cout<<r<<" "<<getsum(tree,r)<<endl;
            update(tree,r,-1,n);
        }
      if(getsum(tree,n-1)==0)
    cout<<0;
    else
    {
    for(int i=0;i<n;i++)
    {

        //cout<<getsum(tree,i)<<" ";
        if(getsum(tree,i)>0)
        {cout<<i+1<<endl;
        break;}
    }
    }

	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int getSum(int BITree[], int index)
{
	int sum = 0;
    index = index + 1;
    while (index>0)
	{
		sum += BITree[index];
		index -= index & (-index);
	}
	return sum;
}
void updateBIT(int BITree[], int n, int index, int val)
{
	index = index + 1;
     while (index <= n)
	{
	BITree[index] += val;
    index += index & (-index);
	}
}
int *constructBITree(int arr[], int n)
{
	int *BITree = new int[n+1];
	for (int i=1; i<=n; i++)
		BITree[i] = 0;
	for (int i=0; i<n; i++)
		updateBIT(BITree, n, i, arr[i]);
	return BITree;
}
int main()
{
    int n,q,x;
    cin>>n>>q;
    int a[n];
    memset(a,0,sizeof(a));
    for(int i=0;i<n;i++)
    {
        cin>>x;
        a[x-1]++;
    }

	int *BITree = constructBITree(a, n);
	while(q--)
	{
	    int x;
	    cin>>x;
	    if(x>0)
	    {
	        updateBIT(BITree,n,x-1,1);
	    }
	    else
	    {
	        int z=abs(x);
            int l=0,r=n-1;
            while(r-l>1)
            {
                int mid=(l+r)/2;
                int y=getSum(BITree,mid);
                if(y>z)
                {
                    r=mid;
                }
                else if(y<z)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }
            }

            if(getSum(BITree, l)>=z)
            {
                updateBIT(BITree,n,l,-1);
            }
            else
            {
                updateBIT(BITree,n,r,-1);
            }

	    }
	}
    if(getSum(BITree,n)==0)
    {cout<<0;
    return 0;}
    for(int i=0;i<n;i++)
    {
        if(getSum(BITree,i)>0)
        {
            cout<<i+1;
            return 0;
        }
    }
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;
int getSum(int BITree[], int index)
{
	int sum = 0;
    index = index + 1;
    while (index>0)
	{
		sum += BITree[index];
		index -= index & (-index);
	}
	return sum;
}
void updateBIT(int BITree[], int n, int index, int val)
{
	index = index + 1;
     while (index <= n)
	{
	BITree[index] += val;
    index += index & (-index);
	}
}
int *constructBITree(int arr[], int n)
{
	int *BITree = new int[n+1];
	for (int i=1; i<=n; i++)
		BITree[i] = 0;
	for (int i=0; i<n; i++)
		updateBIT(BITree, n, i, arr[i]);
	return BITree;
}
int main()
{
    FAST;
    int n,q,x;
    cin>>n>>q;
    int a[n];
    memset(a,0,sizeof(a));
    for(int i=0;i<n;i++)
    {
        cin>>x;
        a[x-1]++;
    }

	int *BITree = constructBITree(a, n);
	while(q--)
	{
	    int x;
	    cin>>x;
	    if(x>0)
	    {
	        updateBIT(BITree,n,x-1,1);
	    }
	    else
	    {
	        int z=abs(x);
            int l=0,r=n-1;
            while(r-l>1)
            {
                int mid=(l+r)/2;
                int y=getSum(BITree,mid);
                if(y>z)
                {
                    r=mid;
                }
                else if(y<z)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }
            }

            if(getSum(BITree, l)>=z)
            {
                updateBIT(BITree,n,l,-1);
            }
            else
            {
                updateBIT(BITree,n,r,-1);
            }

	    }
	}
    if(getSum(BITree,n-1)==0)
    {cout<<0;
    return 0;}
    for(int i=0;i<n;i++)
    {
        if(getSum(BITree,i)>0)
        {
            cout<<i+1;
            return 0;
        }
    }
	return 0;
}


/* EK BAAR AUR */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
/*
ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/

//ll cnt;
/*void bfs(ll x,ll vis[],vector<ll> v[])
{
    for(auto i:v[x])
    {
        if(!vis[i])
        {
            vis[i]=1;
            cnt++;
            bfs(i,vis,v);
        }
    }
}*/
ll getsum(ll tree[],ll index)
{
    index++;
    ll sum=0;
    while(index>0)
    {
        sum+=tree[index];
        index-=(index&-index);
    }
    return sum;
}
void update(ll tree[],ll index,ll value,ll n)
{
    index++;
    while(index<=n)
    {
        tree[index]+=value;
        index+=(index&-index);
    }
}
ll *buildtree(ll n,ll a[])
{
    ll *tree=new ll[n+1];
    for(ll i=0;i<=n;i++)
    tree[i]=0;
    for(ll i=0;i<n;i++)
    {
        update(tree,i,a[i],n);
    }
    return tree;
}
int main()
{
    FAST;
    ll n,q,x;
    cin>>n>>q;
    ll a[n];
    mem0(a);
    loop(i,0,n-1)
    {
        cin>>x;
        x--;
        a[x]++;
    }
    ll *tree=buildtree(n,a);
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            update(tree,x-1,1,n);
        }
        else
        {

            ll ans;
            x*=-1;
            ll s = 0, e = n-1;
            while(s <= e){
                int mid = (s+e) >> 1;
                if(getsum(tree,mid) >= x){
                    ans = mid;
                    e = mid-1;
                } else s = mid+1;
            }
            // cout << ans << endl;
            // cout << ft.sum(1) << endl;
            update(tree,ans,-1,n);
            //cout<<r<<" "<<getsum(tree,r)<<endl;
            //update(tree,r,-1,n);
        }
    }
    if(getsum(tree,n-1)==0)
    cout<<0;
    else
    {
    for(ll i=0;i<n;i++)
    {

        //cout<<getsum(tree,i)<<" ";
        if(getsum(tree,i)>0)
        {cout<<i+1<<endl;
        break;}
    }

    }
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
/*
ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
//SEGMENT TREE
void buildtree(ll *tree,ll *a,ll index,ll start,ll end)
{
    if(start>end)
    return ;
    if(start==end)
    {
        tree[index]=a[start];
        return;
    }
    ll mid=(start+end)/2;
    buildtree(tree,a,2*index,start,mid);
    buildtree(tree,a,2*index+1,mid+1,end);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]^tree[2*index+1];
    ll x=log2(e-s+1);
    if(x%2==1)
    tree[index]=tree[2*index]|tree[2*index+1];
    else
    tree[index]=tree[2*index]^tree[2*index+1];

    return ;
}

void updaterange(ll *tree,ll index,ll s,ll e,ll rs,ll re,ll val)
{
    if(rs>e||s>re)
    return ;
    if(s==e)
    {
        tree[index]^=val;
        return ;
    }
    ll mid=(s+e)/2;
    updaterange(tree,2*index,s,mid,rs,re,val);
    updaterange(tree,2*index+1,mid+1,e,rs,re,val);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
*/
void fun(ll a[],ll x,ll n)
{
    ll cnt=0;
    for(ll i=1;i<=n;i++)
    {
        cnt+=a[i];
        if(cnt>=x)
        {
            a[i]--;
            return ;
        }
    }
}
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll a[n+2];
    memset(a,0,sizeof(a));
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        a[x]++;
    }
    for(ll i=0;i<q;i++)
    {
        cin>>x;
        if(x>0)
        a[x]++;
        else
        fun(a,abs(x),n);
    }
    for(ll i=1;i<=n;i++)
    {
        //cout<<a[i]<<" ";
        if(a[i])
        {
            cout<<i;
            return 0;
        }
    }
    cout<<0;
    return 0;
}


/* NEVER GIVE UP */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
/*ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}

ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/
void buildtree(ll *tree,ll *a,ll index,ll start,ll end)
{
    if(start>end)
    return ;
    if(start==end)
    {
        tree[index]=a[start];
        return;
    }
    ll mid=(start+end)/2;
    buildtree(tree,a,2*index,start,mid);
    buildtree(tree,a,2*index+1,mid+1,end);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)// complete overlap
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]+=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]+tree[2*index+1];
    return ;
}
/*
void updaterange(ll *tree,ll index,ll s,ll e,ll rs,ll re,ll val)
{
    if(rs>e||s>re)
    return ;
    if(s==e)
    {
        tree[index]=val;
        return ;
    }
    ll mid=(s+e)/2;
    updaterange(tree,2*index,s,mid,rs,re,val);
    updaterange(tree,2*index+1,mid+1,e,rs,re,val);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=min(left,right);
    return ;
}*/
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll g=log2(n);
    ll a[n+1];
    mem0(a);
    loop(i,1,n)//={1,2,3,4,5,60};
    {
        cin>>x;
        a[x]++;
    }
    ll *tree=new ll[(ll)(0.5+pow(2,g+1))];
    ll index=1;
    ll start=1;
    ll end=n;
    buildtree(tree,a,index,start,end);
    //cout<<query(tree,1,1,n,1,n)<<endl;
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            updatenode(tree,1,1,n,x,1);
        }
        else
        {
            ll z=abs(x);
            ll l=1,r=n;

            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=query(tree,1,1,n,l,mid);
                //cout<<l<<" "<<r<<" y "<<" "<<y<<" ";
                if(y>=z)
                {
                    r=mid;
                }
                else //if(y<z)
                {
                    l=mid;
                }

            }

            if(query(tree,1,1,n,1,l)>=z)
            {
      //          cout<<l<<" ";
                updatenode(tree,1,1,n,l,-1);
            }
            else
            {
        //        cout<<r<<" ";
                updatenode(tree,1,1,n,r,-1);
            }
          //  cout<<query(tree,1,1,n,1,n)<<endl;
        }
     }

    // cout<<endl;
     for(ll i=1;i<=n;i++)
     {
         ll y=query(tree,1,1,n,1,i);
         if(y>0)
         {
             cout<<i;
             return 0;
         }
     }
     cout<<0;
    return 0;
}


/* NEVER GIVE UP */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
/*ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}

ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/
const ll Z=100005;
ll tree[(ll)Z<<2];

ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)// complete overlap
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]+=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]+tree[2*index+1];
    return ;
}
/*
void updaterange(ll *tree,ll index,ll s,ll e,ll rs,ll re,ll val)
{
    if(rs>e||s>re)
    return ;
    if(s==e)
    {
        tree[index]=val;
        return ;
    }
    ll mid=(s+e)/2;
    updaterange(tree,2*index,s,mid,rs,re,val);
    updaterange(tree,2*index+1,mid+1,e,rs,re,val);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=min(left,right);
    return ;
}*/
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll a[n+1];
    mem0(a);
    loop(i,1,n)//={1,2,3,4,5,60};
    {
        cin>>x;
        updatenode(tree,1,1,n,x,1);
    }
    ll index=1;
    ll start=1;
    ll end=n;
    //cout<<query(tree,1,1,n,1,n)<<endl;
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            updatenode(tree,1,1,n,x,1);
        }
        else
        {
            ll z=abs(x);
            ll l=1,r=n;

            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=query(tree,1,1,n,l,mid);
                //cout<<l<<" "<<r<<" y "<<" "<<y<<" ";
                if(y>z)
                {
                    r=mid;
                }
                else if(y<z)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }

            }

            if(query(tree,1,1,n,1,l)>=z)
            {
      //          cout<<l<<" ";
                updatenode(tree,1,1,n,l,-1);
            }
            else
            {
        //        cout<<r<<" ";
                updatenode(tree,1,1,n,r,-1);
            }
          //  cout<<query(tree,1,1,n,1,n)<<endl;
        }
     }

    // cout<<endl;
     for(ll i=1;i<=n;i++)
     {
         ll y=query(tree,1,1,n,1,i);
         if(y>0)
         {
             cout<<i;
             return 0;
         }
     }
     cout<<0;
    return 0;
}


// C++ code to demonstrate operations of Binary Index Tree
#include <bits/stdc++.h>
#define ll long long
using namespace std;

/*		 n --> No. of elements present in input array.
	BITree[0..n] --> Array that represents Binary Indexed Tree.
	arr[0..n-1] --> Input array for which prefix sum is evaluated. */

// Returns sum of arr[0..index]. This function assumes
// that the array is preprocessed and partial sums of
// array elements are stored in BITree[].
int getSum(int BITree[], int index)
{
	int sum = 0; // Iniialize result

	// index in BITree[] is 1 more than the index in arr[]
	index = index + 1;

	// Traverse ancestors of BITree[index]
	while (index>0)
	{
		// Add current element of BITree to sum
		sum += BITree[index];

		// Move index to parent node in getSum View
		index -= index & (-index);
	}
	return sum;
}

// Updates a node in Binary Index Tree (BITree) at given index
// in BITree. The given value 'val' is added to BITree[i] and
// all of its ancestors in tree.
void updateBIT(int BITree[], int n, int index, int val)
{
	// index in BITree[] is 1 more than the index in arr[]
	index = index + 1;

	// Traverse all ancestors and add 'val'
	while (index <= n)
	{
	// Add 'val' to current node of BI Tree
	BITree[index] += val;

	// Update index to that of parent in update View
	index += index & (-index);
	}
}

// Constructs and returns a Binary Indexed Tree for given
// array of size n.
int *constructBITree(int arr[], int n)
{
	// Create and initialize BITree[] as 0
	int *BITree = new int[n+1];
	for (int i=1; i<=n; i++)
		BITree[i] = 0;

	// Store the actual values in BITree[] using update()
	for (int i=0; i<n; i++)
		updateBIT(BITree, n, i, arr[i]);

	// Uncomment below lines to see contents of BITree[]
	//for (int i=1; i<=n; i++)
	//	 cout << BITree[i] << " ";

	return BITree;
}

// Driver program to test above functions
int main()
{
    int n,q,x;
    cin>>n>>q;
    int a[n];
    memset(a,0,sizeof(a));
    for(int i=0;i<n;i++)
    {
        cin>>x;
        a[x-1]++;
    }

	int *BITree = constructBITree(a, n);
	while(q--)
	{
	    int x;
	    cin>>x;
	    if(x>0)
	    {
	        updateBIT(BITree,n,x-1,1);
	    }
	    else
	    {
	        int z=abs(x);
            int l=0,r=n-1;
            while(r-l>1)
            {
                int mid=(l+r)/2;
                int y=getSum(BITree,mid);
                //cout<<l<<" "<<r<<" y "<<" "<<y<<" ";
                if(y>z)
                {
                    r=mid;
                }
                else if(y<z)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }
            }

            if(getSum(BITree, l)>=z)
            {
      //          cout<<l<<" ";
                updateBIT(BITree,n,l,-1);
                //updatenode(tree,1,1,n,l,-1);
            }
            else
            {
        //        cout<<r<<" ";
                updateBIT(BITree,n,r,-1);
                //updatenode(tree,1,1,n,r,-1);
            }

	    }
	}

    for(int i=0;i<n;i++)
    {
        if(getSum(BITree,i)>0)
        {
            cout<<i+1;
            return 0;
        }
    }
    cout<<0;
	return 0;
}


int getSum(int BITree[], int index)
{
    int sum = 0; // Iniialize result

    // index in BITree[] is 1 more than the index in arr[]
    index = index + 1;

    // Traverse ancestors of BITree[index]
    while (index>0)
    {
        // Add current element of BITree to sum
        sum += BITree[index];

        // Move index to parent node in getSum View
        index -= index & (-index);
    }
    return sum;
}

// Updates a node in Binary Index Tree (BITree) at given index
// in BITree. The given value 'val' is added to BITree[i] and
// all of its ancestors in tree.
void updateBIT(int BITree[], int n, int index, int val)
{
    // index in BITree[] is 1 more than the index in arr[]
    index = index + 1;

    // Traverse all ancestors and add 'val'
    while (index <= n)
    {
    // Add 'val' to current node of BI Tree
    BITree[index] += val;

    // Update index to that of parent in update View
    index += index & (-index);
    }
}

// Constructs and returns a Binary Indexed Tree for given
// array of size n.
int *constructBITree(int arr[], int n)
{
    // Create and initialize BITree[] as 0
    int *BITree = new int[n+1];
    for (int i=1; i<=n; i++)
        BITree[i] = 0;

    // Store the actual values in BITree[] using update()
    for (int i=0; i<n; i++)
        updateBIT(BITree, n, i, arr[i]);

    // Uncomment below lines to see contents of BITree[]
    //for (int i=1; i<=n; i++)
    //     cout << BITree[i] << " ";

    return BITree;
}

int mid;

int main(){
    FAST;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,q;
    cin >> n >> q;
    int a[n+1]={0},aa;
    FOR(i,0,n){
        cin>>aa;
        a[aa]++;
    }
    int b;
    int *BITree = constructBITree(a, n+1);
    int l,r,mid;
    while(q--)
    {
        cin >> b;
        if(b>0){
            updateBIT(BITree, n+1, b, 1);
        }
        else
        {
            b*=-1;
            l=1,r=n;
            while(1)
            {
                if(r-l>1)
                {
                    mid=(l+r)/2;
                    if(getSum(BITree,mid)>=b)
                    {
                        r=mid;
                    }
                    else
                    {
                        l=mid;
                    }
                }
                else
                break;
            }
            if(getSum(BITree,l)>=b) r=l;
            updateBIT(BITree, n+1, r, -1);
        }
    }
    if( getSum(BITree, n)==0 )
    {
        cout << 0;
    }
    else
    {
        for(int i=1;i<=n;i++){
            if(getSum(BITree,i)){
               cout << i;
                return 0;
            }
        }
    }
    return 0;
}


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

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG
#define VALUE(x)
#define debug(...)
#endif

#define FAST               ios_base::sync_with_stdio(false);\
                            cin.tie(0);\
                            cout.tie(0);
#define endl                "\n"
#define FOR(a, b, c)        for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c)       for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c)       for (int(a) = (b); (a) >= (c); --(a))
#define FORSQ(a, b, c)      for (int(a) = (b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c)       for (char(a) = (b); (a) <= (c); ++(a))
#define rep(i, n)           FOR(i, 0, n)
#define repn(i, n)          FORN(i, 1, n)
#define MAX(a, b)           a = max(a, b)
#define MIN(a, b)           a = min(a, b)
#define SQR(x)              ((ll)(x) * (x))
#define RESET(a, b)         memset(a, b, sizeof(a))
#define fi                  first
#define se                  second
#define mp                  make_pair
#define pb                  push_back
#define ALL(v)              v.begin(), v.end()
#define ALLA(arr, sz)       arr, arr + sz
#define SIZE(v)             (int)v.size()
#define SORT(v)             sort(ALL(v))
#define REVERSE(v)          reverse(ALL(v))
#define SORTA(arr, sz)      sort(ALLA(arr, sz))
#define REVERSEA(arr, sz)   reverse(ALLA(arr, sz))

ll power(ll x,ll y){
    if(y==0) return 1;
    return x*power(x,y-1);
}

int getSum(int BITree[], int index)
{
    int sum = 0; // Iniialize result

    // index in BITree[] is 1 more than the index in arr[]
    index = index + 1;

    // Traverse ancestors of BITree[index]
    while (index>0)
    {
        // Add current element of BITree to sum
        sum += BITree[index];

        // Move index to parent node in getSum View
        index -= index & (-index);
    }
    return sum;
}

// Updates a node in Binary Index Tree (BITree) at given index
// in BITree. The given value 'val' is added to BITree[i] and
// all of its ancestors in tree.
void updateBIT(int BITree[], int n, int index, int val)
{
    // index in BITree[] is 1 more than the index in arr[]
    index = index + 1;

    // Traverse all ancestors and add 'val'
    while (index <= n)
    {
    // Add 'val' to current node of BI Tree
    BITree[index] += val;

    // Update index to that of parent in update View
    index += index & (-index);
    }
}

// Constructs and returns a Binary Indexed Tree for given
// array of size n.
int *constructBITree(int arr[], int n)
{
    // Create and initialize BITree[] as 0
    int *BITree = new int[n+1];
    for (int i=1; i<=n; i++)
        BITree[i] = 0;

    // Store the actual values in BITree[] using update()
    for (int i=0; i<n; i++)
        updateBIT(BITree, n, i, arr[i]);

    // Uncomment below lines to see contents of BITree[]
    //for (int i=1; i<=n; i++)
    //     cout << BITree[i] << " ";

    return BITree;
}

int mid;

int main(){
    tezi
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,q;
    cin >> n >> q;
    int a[n+1]={0},aa;
    FOR(i,0,n){
        cin>>aa;
        a[aa]++;
    }
    int b;
    int *BITree = constructBITree(a, n+1);
    int l,r,mid;
    while(q--){
        cin >> b;
        if(b>0){
            updateBIT(BITree, n+1, b, 1);
        }else{
            b*=-1;
            l=1,r=n;
            while(1){
                if(r-l>1){
                    mid=(l+r)/2;
                    if(getSum(BITree,mid)>=b){
                        r=mid;
                    }else{
                        l=mid;
                    }
                }else{
                    break;
                }
            }
            if(getSum(BITree,l)>=b)r=l;
            updateBIT(BITree, n+1, r, -1);
        }
    }
    if( getSum(BITree, n)==0 ){
        cout << 0;
    }else{
        for(int i=1;i<=n;i++){
            if(getSum(BITree,i)){
               cout << i;
                return 0;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;
int getSum(int BITree[], int index)
{
	int sum = 0;
    index = index + 1;
    while (index>0)
	{
		sum += BITree[index];
		index -= index & (-index);
	}
	return sum;
}
void updateBIT(int BITree[], int n, int index, int val)
{
	index = index + 1;
     while (index <= n)
	{
	BITree[index] += val;
    index += index & (-index);
	}
}
int *constructBITree(int arr[], int n)
{
	int *BITree = new int[n+1];
	for (int i=1; i<=n; i++)
		BITree[i] = 0;
	for (int i=0; i<n; i++)
		updateBIT(BITree, n, i, arr[i]);
	return BITree;
}
int main()
{
    FAST;
    int n,q,x;
    cin>>n>>q;
    int a[n+1];
    memset(a,0,sizeof(a));
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        a[x]++;
    }

	int *BITree = constructBITree(a, n+1);
	while(q--)
	{
	    int x;
	    cin>>x;
	    if(x>0)
	    {
	        updateBIT(BITree,n+1,x,1);
	    }
	    else
	    {
	        int z=abs(x);
            int l=1,r=n;
            while(r-l>1)
            {
                int mid=(l+r)/2;
                int y=getSum(BITree,mid);
                if(y>z)
                {
                    r=mid;
                }
                else if(y<z)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }
            }

            if(getSum(BITree, l)>=z)
            {
                updateBIT(BITree,n+1,l,-1);
            }
            else
            {
                updateBIT(BITree,n+1,r,-1);
            }

	    }
	}
    if(getSum(BITree,n)==0)
    {cout<<0;
    return 0;}
    for(int i=1;i<=n;i++)
    {
        if(getSum(BITree,i)>0)
        {
            cout<<i;
            return 0;
        }
    }
	return 0;
}


/* EK BAAR AUR */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
/*
ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/

//ll cnt;
/*void bfs(ll x,ll vis[],vector<ll> v[])
{
    for(auto i:v[x])
    {
        if(!vis[i])
        {
            vis[i]=1;
            cnt++;
            bfs(i,vis,v);
        }
    }
}*/
ll getsum(ll tree[],ll index)
{
    index++;
    ll sum=0;
    while(index>0)
    {
        sum+=tree[index];
        index-=(index&-index);
    }
    return sum;
}
void update(ll tree[],ll index,ll value,ll n)
{
    index++;
    while(index<=n)
    {
        tree[index]+=value;
        index+=(index&-index);
    }
}
ll *buildtree(ll n,ll a[])
{
    ll *tree=new ll[n+1];
    for(ll i=0;i<=n;i++)
    tree[i]=0;
    for(ll i=0;i<n;i++)
    {
        update(tree,i,a[i],n);
    }
    return tree;
}
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll a[n];
    mem0(a);
    loop(i,0,n-1)
    {
        cin>>x;
        x--;
        a[x]++;
    }
    ll *tree=buildtree(n,a);
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            update(tree,x-1,1,n);
        }
        else
        {
            ll l=0;
            x*=-1;
            ll r=n-1;
            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=getsum(tree,mid);
                if(y>x)
                {
                    r=mid;
                }
                else if(y<x)
                {
                    l=mid;
                }
                else
                {
                    l=mid;
                    r=mid;
                    break;
                }

            }
            if(getsum(tree,l)>=x)
            {
                r=l;
            }
            //cout<<r<<" "<<getsum(tree,r)<<endl;
            update(tree,r,-1,n);
        }
    }
    if(getsum(tree,n-1)==0)
    cout<<0;
    else
    {
    for(ll i=0;i<n;i++)
    {

        //cout<<getsum(tree,i)<<" ";
        if(getsum(tree,i)>0)
        {cout<<i+1<<endl;
        break;}
    }

    }
    return 0;
}


/* NEVER GIVE UP */
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define vi             vector<ll>
#define mi             map<ll,ll>
#define pi             pair<ll,ll>
#define si             set<ll>
#define endl            "\n"
#define N              1000000007
#define PI              3.1415926535897932384
#define inf             1000000000000000005
#define ll              long long
#define f               first
#define s              second
#define pb             push_back
#define fr(n)          for(ll i=0;i<n;i++)
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);
#define NN             998244353
#define mem1(vis)     memset(vis,-1,sizeof(vis))
#define mem0(vis)     memset(vis,0,sizeof(vis));
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define make make_pair
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define sz(a) (int)a.size()
#define loop(i,a,b) for(ll i=a;i<=b;i++)

/*
CHAR_BIT       = number of bits in a char
CHAR_MIN/MAX   = min/max value for a char
INT_MIN/MAX    = min/max value for an int
LLONG_MIN/MAX  = min/max value for a long long
*/

//std::ifstream in("input.txt");
//std::ofstream out("output.txt");
ll prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
/*
ll find(ll n)
{
    while(1)
    {
        if(n==parent[n])
        return n;
        else
        n=parent[n];
    }
}
void union(ll a,ll b)
{
    ll x=find(a);
    ll y=find(b);
    if(x==y)
    return ;
    else
    parent[x]=y;
}
//ll dp[500001][500001];

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n,ll p)
{
   return power(n, p-2, p);
}
*/
void buildtree(ll *tree,ll *a,ll index,ll start,ll end)
{
    if(start>end)
    return ;
    if(start==end)
    {
        tree[index]=a[start];
        return;
    }
    ll mid=(start+end)/2;
    buildtree(tree,a,2*index,start,mid);
    buildtree(tree,a,2*index+1,mid+1,end);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=left+right;
    return ;
}
ll query(ll *tree,ll index,ll s,ll e,ll qs,ll qe)
{
    // no overlap
    if(qs>e||s>qe)
    return 0;
    if(qe>=e&&s>=qs)// complete overlap
    {
        return tree[index];
    }
    ll mid=(s+e)/2;
    ll left=query(tree,2*index,s,mid,qs,qe);
    ll right=query(tree,2*index+1,mid+1,e,qs,qe);
    return left+right;
}
void updatenode(ll *tree,ll index,ll s,ll e,ll i,ll val)
{
    if(i>e||i<s)
    return ;
    if(s==e)
    {
        tree[index]+=val;
        return ;
    }
    ll mid=(s+e)/2;
    updatenode(tree,2*index,s,mid,i,val);
    updatenode(tree,2*index+1,mid+1,e,i,val);
    tree[index]=tree[2*index]+tree[2*index+1];
    return ;
}
/*
void updaterange(ll *tree,ll index,ll s,ll e,ll rs,ll re,ll val)
{
    if(rs>e||s>re)
    return ;
    if(s==e)
    {
        tree[index]=val;
        return ;
    }
    ll mid=(s+e)/2;
    updaterange(tree,2*index,s,mid,rs,re,val);
    updaterange(tree,2*index+1,mid+1,e,rs,re,val);
    ll left=tree[2*index];
    ll right=tree[2*index+1];
    tree[index]=min(left,right);
    return ;
}*/
int main()
{
    ll n,q,x;
    cin>>n>>q;
    ll a[n+1];
    mem0(a);
    loop(i,1,n)//={1,2,3,4,5,60};
    {
        cin>>x;
        a[x]++;
    }
    ll *tree=new ll[4*n+5];
    ll index=1;
    ll start=1;
    ll end=n;
    buildtree(tree,a,index,start,end);
    //cout<<query(tree,1,1,n,1,n)<<endl;
    while(q--)
    {
        cin>>x;
        if(x>0)
        {
            updatenode(tree,1,1,n,x,1);
        }
        else
        {
            ll z=abs(x);
            ll l=1,r=n;

            while(r-l>1)
            {
                ll mid=(l+r)/2;
                ll y=query(tree,1,1,n,l,mid);
                //cout<<l<<" "<<r<<" y "<<" "<<y<<" ";
                if(y>=z)
                {
                    r=mid;
                }
                else //if(y<z)
                {
                    l=mid;
                }

            }

            if(query(tree,1,1,n,1,l)>=z)
            {
      //          cout<<l<<" ";
                updatenode(tree,1,1,n,l,-1);
            }
            else
            {
        //        cout<<r<<" ";
                updatenode(tree,1,1,n,r,-1);
            }
          //  cout<<query(tree,1,1,n,1,n)<<endl;
        }
     }

    // cout<<endl;
     for(ll i=1;i<=n;i++)
     {
         ll y=query(tree,1,1,n,1,i);
         if(y>0)
         {
             cout<<i;
             return 0;
         }
     }
     cout<<0;
    return 0;
}