There are n students and m clubs in a college. The clubs are numbered from 1 to m. Each student has a potential p_i and is a member of the club with index c_i. Initially, each student is a member of exactly one club. A technical fest starts in the college, and it will run for the next d days. There is a coding competition every day in the technical fest. 

Every day, in the morning, exactly one student of the college leaves their club. Once a student leaves their club, they will never join any club again. Every day, in the afternoon, the director of the college will select one student from each club (in case some club has no members, nobody is selected from that club) to form a team for this day's coding competition. The strength of a team is the mex of potentials of the students in the team. The director wants to know the maximum possible strength of the team for each of the coming d days. Thus, every day the director chooses such team, that the team strength is maximized.

The mex of the multiset S is the smallest non-negative integer that is not present in S. For example, the mex of the \{0, 1, 1, 2, 4, 5, 9\} is 3, the mex of \{1, 2, 3\} is 0 and the mex of ∅ (empty set) is 0.

Input

The first line contains two integers n and m (1 ≤ m ≤ n ≤ 5000), the number of students and the number of clubs in college.

The second line contains n integers p_1, p_2, …, p_n (0 ≤ p_i < 5000), where p_i is the potential of the i-th student.

The third line contains n integers c_1, c_2, …, c_n (1 ≤ c_i ≤ m), which means that i-th student is initially a member of the club with index c_i.

The fourth line contains an integer d (1 ≤ d ≤ n), number of days for which the director wants to know the maximum possible strength of the team. 

Each of the next d lines contains an integer k_i (1 ≤ k_i ≤ n), which means that k_i-th student lefts their club on the i-th day. It is guaranteed, that the k_i-th student has not left their club earlier.

Output

For each of the d days, print the maximum possible strength of the team on that day.

Examples

Input


5 3
0 1 2 2 0
1 2 2 3 2
5
3
2
4
5
1


Output


3
1
1
1
0


Input


5 3
0 1 2 2 1
1 3 2 3 2
5
4
2
3
5
1


Output


3
2
2
1
0


Input


5 5
0 1 2 4 5
1 2 3 4 5
4
2
3
5
4


Output


1
1
1
1

Note

Consider the first example:

On the first day, student 3 leaves their club. Now, the remaining students are 1, 2, 4 and 5. We can select students 1, 2 and 4 to get maximum possible strength, which is 3. Note, that we can't select students 1, 2 and 5, as students 2 and 5 belong to the same club. Also, we can't select students 1, 3 and 4, since student 3 has left their club.

On the second day, student 2 leaves their club. Now, the remaining students are 1, 4 and 5. We can select students 1, 4 and 5 to get maximum possible strength, which is 1.

On the third day, the remaining students are 1 and 5. We can select students 1 and 5 to get maximum possible strength, which is 1.

On the fourth day, the remaining student is 1. We can select student 1 to get maximum possible strength, which is 1. 

On the fifth day, no club has students and so the maximum possible strength is 0.
import java.util.*;

import java.io.*;
import java.math.BigInteger;

public class E {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public class Edge implements Comparable<Edge> {
		int from;
		int to;
		long len;

		public Edge(int from, int to, long len) {
			this.from = from;
			this.to = to;
			this.len = len;
		}

		@Override
		public int compareTo(Edge o) {
			if (len > o.len) {
				return 1;
			}
			if (len < o.len) {
				return -1;
			}
			return 0;
		}

	}

	public class DSU {
		int[] sz;
		int[] p;

		public DSU(int n) {
			sz = new int[n];
			p = new int[n];
			for (int i = 0; i < p.length; i++) {
				p[i] = i;
				sz[i] = 1;
			}
		}

		public int get(int x) {
			if (x == p[x]) {
				return x;
			}
			int par = get(p[x]);
			p[x] = par;
			return par;
		}

		public boolean unite(int a, int b) {
			int pa = get(a);
			int pb = get(b);
			if (sz[pa] == 1) {
				p[pa] = pb;
				sz[pb] += sz[pa];
				return true;
			}
			if (sz[pb] == 1) {
				p[pb] = pa;
				sz[pa] += sz[pb];
				return true;
			}
			return false;
		}
	}

	public class SegmentTree {
		int pow;
		long[] sum;
		long[] delta;
		boolean[] flag;

		public SegmentTree(long[] a) {
			pow = 1;
			while (pow < a.length) {
				pow *= 2;
			}
			flag = new boolean[2 * pow];
			sum = new long[2 * pow];
			delta = new long[2 * pow];
			for (int i = 0; i < a.length; i++) {
				sum[pow + i] = a[i];
			}
			for (int i = pow - 1; i > 0; i--) {
				sum[i] = f(sum[2 * i], sum[2 * i + 1]);
			}
		}

		public long get(int v, int tl, int tr, int l, int r) {
			push(v, tl, tr);
			if (l > r) {
				return 0;
			}
			if (l == tl && r == tr) {
				return sum[v];
			}
			int tm = (tl + tr) / 2;
			return f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));
		}

		public void set(int v, int tl, int tr, int l, int r, long x) {
			push(v, tl, tr);
			if (l > tr || r < tl) {
				return;
			}
			if (l <= tl && r >= tr) {
				delta[v] = x;
				flag[v] = true;
				push(v, tl, tr);
				return;
			}
			int tm = (tl + tr) / 2;
			set(2 * v, tl, tm, l, r, x);
			set(2 * v + 1, tm + 1, tr, l, r, x);
			sum[v] = f(sum[2 * v], sum[2 * v + 1]);
		}

		public void push(int v, int tl, int tr) {
			if (flag[v]) {
				if (v < pow) {
					flag[2 * v] = true;
					flag[2 * v + 1] = true;
					delta[2 * v] = delta[v];
					delta[2 * v + 1] = delta[v];
				}
				flag[v] = false;
				sum[v] = delta[v] * (tr - tl + 1);
			}
		}

		public long f(long a, long b) {
			return a + b;
		}
	}

	public class SegmentTreeUp {
		int pow;
		long[] sum;
		long[] delta;
		boolean[] flag;

		public SegmentTreeUp(long[] a) {
			pow = 1;
			while (pow < a.length) {
				pow *= 2;
			}
			flag = new boolean[2 * pow];
			sum = new long[2 * pow];
			delta = new long[2 * pow];
			for (int i = 0; i < a.length; i++) {
				sum[pow + i] = a[i];
			}
			for (int i = pow - 1; i > 0; i--) {
				sum[i] = f(sum[2 * i], sum[2 * i + 1]);
			}
		}

		public long get(int v, int tl, int tr, int l, int r) {
			push(v, tl, tr);
			if (l > r) {
				return 0;
			}
			if (l == tl && r == tr) {
				return sum[v];
			}
			int tm = (tl + tr) / 2;
			return f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));
		}

		public void set(int v, int tl, int tr, int l, int r, long x) {
			push(v, tl, tr);
			if (l > tr || r < tl) {
				return;
			}
			if (l <= tl && r >= tr) {
				delta[v] = x;
				flag[v] = true;
				push(v, tl, tr);
				return;
			}
			int tm = (tl + tr) / 2;
			set(2 * v, tl, tm, l, r, x);
			set(2 * v + 1, tm + 1, tr, l, r, x);
			sum[v] = f(sum[2 * v], sum[2 * v + 1]);
		}

		public void push(int v, int tl, int tr) {
			if (flag[v]) {
				if (v < pow) {
					flag[2 * v] = true;
					flag[2 * v + 1] = true;
					delta[2 * v] = delta[v];
					delta[2 * v + 1] = delta[v];
				}
				flag[v] = false;
				sum[v] += delta[v] * (tr - tl + 1);
			}
		}

		public long f(long a, long b) {
			return a + b;
		}
	}

	public class SegmentTreeSet {
		int pow;
		int[] sum;
		int[] delta;
		boolean[] flag;

		public SegmentTreeSet(int[] a) {
			pow = 1;
			while (pow < a.length) {
				pow *= 2;
			}
			flag = new boolean[2 * pow];
			sum = new int[2 * pow];
			delta = new int[2 * pow];
			for (int i = 0; i < a.length; i++) {
				sum[pow + i] = a[i];
			}
		}

		public int get(int v, int tl, int tr, int l, int r) {
			push(v, tl, tr);
			if (l > r) {
				return 0;
			}
			if (l == tl && r == tr) {
				return sum[v];
			}
			int tm = (tl + tr) / 2;
			return f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));
		}

		public void set(int v, int tl, int tr, int l, int r, int x) {
			push(v, tl, tr);
			if (l > tr || r < tl) {
				return;
			}
			if (l <= tl && r >= tr) {
				delta[v] = x;
				flag[v] = true;
				push(v, tl, tr);
				return;
			}
			int tm = (tl + tr) / 2;
			set(2 * v, tl, tm, l, r, x);
			set(2 * v + 1, tm + 1, tr, l, r, x);
			sum[v] = f(sum[2 * v], sum[2 * v + 1]);
		}

		public void push(int v, int tl, int tr) {
			if (flag[v]) {
				if (v < pow) {
					flag[2 * v] = true;
					flag[2 * v + 1] = true;
					delta[2 * v] = delta[v];
					delta[2 * v + 1] = delta[v];
				}
				flag[v] = false;
				sum[v] = delta[v] * (tr - tl + 1);
			}
		}

		public int f(int a, int b) {
			return a + b;
		}
	}

	public class Pair implements Comparable<Pair> {
		long x;
		long y;
		int n;

		public Pair(long x, long y, int n) {
			this.x = x;
			this.y = y;
			this.n = n;
		}

		@Override
		public int compareTo(Pair o) {
			if (x - y > o.x - o.y) {
				return 1;
			}
			if (x - y < o.x - o.y) {
				return -1;
			}
			return 0;
		}
	}

	long mod;
	Random random = new Random();

	public void shuffle(int[][] a) {
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++) {
				int x = random.nextInt(j + 1);
				int t = a[i][x];
				a[i][x] = a[i][j];
				a[i][j] = t;
			}
		}
	}

	public void sort(int[][] a) {
		for (int i = 0; i < a.length; i++) {
			Arrays.sort(a[i]);
		}
	}

	public static class Fenvik {
		long[] t;

		public Fenvik(int n) {
			t = new long[n];
		}

		public void add(int x, long delta) {
			for (int i = x; i < t.length; i = (i | (i + 1))) {
				t[i] += delta;
			}
		}

		private long sum(int r) {
			long ans = 0;
			int x = r;
			while (x >= 0) {
				ans += t[x];
				x = (x & (x + 1)) - 1;
			}
			return ans;
		}

		public long sum(int l, int r) {
			return sum(r) - sum(l - 1);
		}
	}

	int[] mt;
	boolean[] used;
	 
	boolean kuhn(int v) {
		if (used[v])  return false;
		used[v] = true;
		for (int i = 0; i < to[v].size(); i++) {
			int e = to[v].get(i);
			if (mt[e] == -1) {
				mt[e] = v;
				return true;
			}
		}
		for (int i = 0; i < to[v].size(); i++) {
			int e = to[v].get(i);
			if (kuhn(mt[e])) {
				mt[e] = v;
				return true;
			}
		}
		return false;
	}
	
	public int count() {
		int ans = 0;
		for (int i = 0; i < mt.length; i++) {
			if (mt[i] >= 0) {
				ans++;
			}
		}
		return ans;
	}

	ArrayList<Integer>[] to;
	
	public void solve() {
		int n = in.nextInt();
		int m = in.nextInt();
		used = new boolean[n];
		mt = new int[m];
		to = new ArrayList[5001];
		for (int i = 0; i < to.length; i++) {
			to[i] = new ArrayList<>();
		}
		int[] p = new int[n];
		for (int i = 0; i < p.length; i++) {
			p[i] = in.nextInt();
		}
		int[] c = new int[n];
		for (int i = 0; i < c.length; i++) {
			c[i] = in.nextInt() - 1;
		}
		for (int i = 0; i < p.length; i++) {
			to[p[i]].add(c[i]);
		}
		for (int i = 0; i < to.length; i++) {
			Collections.shuffle(to[i]);
		}
		for (int i = 0; i < mt.length; i++) {
			mt[i] = -1;
		}
		for (int i = 0; i < n; i++) {
			used = new boolean[n];
			if (!kuhn(i)) {
				break;
			}
		}
		
		int q = in.nextInt();
		for (int w = 0; w < q; w++) {
//			for (int i = 0; i < to.length; i++) {
//				for (int j : to[i]) {
//					System.out.print(j + " ");
//				}
//				System.out.println(to[i].size());
//			}
//			System.out.println("sdfghj " + q);
//			for (int i = 0; i < mt.length; i++) {
//				System.out.print(mt[i] + " ");
//			}
//			System.out.println();
//			System.out.println();
			int x = in.nextInt() - 1;
			for (int i = 0; i < to[p[x]].size(); i++) {
				if (to[p[x]].get(i) == c[x]) {
					to[p[x]].remove(i);
					break;
				}
			}
			if (mt[c[x]] == p[x]) {
				for (int i = 0; i < mt.length; i++) {
					if (mt[i] >= p[x]) {
						mt[i] = -1;
					}
				}
				for (int i = p[x]; i < c.length; i++) {
					if (!kuhn(i)) {
						used = new boolean[n];
						if (!kuhn(i)) {
							break;
						}
					}
				}
			}
			out.println(count());
		}
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				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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