import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class game_dg {

	public static void main(String[] args) {
		new Thread(){
			public void run() {
				try {
					new game_dg().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}.start();
	}
	
	final int maxN = 100;
	final int maxScore = 100;
	final int maxNum = 100;
	
	protected void run() throws IOException {
		Scanner in = new Scanner(new File("game.in"));
		PrintWriter out = new PrintWriter("game.out");
		
		int n = in.nextInt();
		
		assert n >= 2 && n <= maxN : "Wrong n";
		
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = in.nextInt();
			assert d[i] >= 0 && d[i] <= maxScore : "Wrong score " + (i + 1);
		}
		
		int[] num = new int[n];
		for (int i = 0; i < n - 1; i++) {
			num[i] = in.nextInt();
			assert num[i] >= 1 && num[i] <= maxNum : "Wrong number " + (i + 1);
		}
		
		int res = -1;
		int best = -1;
		for (num[n - 1] = 1; num[n - 1] <= 101; num[n - 1]++) {
			int[] c = new int[102];
			for (int i = 0; i < n; i++) {
				c[num[i]]++;
			}
			int who = -1;
			for (int i = 0; i < n; i++) {
				if (c[num[i]] == 1) {
					if (who == -1 || num[who] > num[i]) {
						who = i;
					}
				}
			}
			
			int[] add = new int[n];
			if (who != -1) {
				add[who] = num[who];
			}
			
			int cur = 0;
			for (int i = 0; i < n - 1; i++) {
				if (d[i] + add[i] < d[n - 1] + add[n - 1]) {
					cur++;
				}
			}
			
			if (cur > best) {
				best = cur;
				res = num[n - 1];
			}
		}
		
		assert !in.hasNext() : "Extra information";
		
		out.println(res);
		
		in.close();
		out.close();
	}

}
