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.
//package com.company;
// Always comment out package when submitting.

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

public class Main {
    public static class Task {

        public class HopcraftKarp {
            int n1, n2, edges;
            int[] last, dist, Q; boolean[] used, vis;
            int[] matching;
            int[] prev, head;
            int res = 0;
            public HopcraftKarp(int n1, int n2, int edges) {
                this.n1 = n1;
                this.n2 = n2;
                last = new int[n1]; dist = new int[n1]; Q = new int[n1]; used = new boolean[n1]; vis = new boolean[n1];
                matching = new int[n2];
                prev = new int[edges];
                head = new int[edges];
                this.edges = 0;
                Arrays.fill(last, -1);
                Arrays.fill(used, false);
                Arrays.fill(matching, -1);
            }

            void addEdge(int u, int v) {
                head[edges] = v;
                prev[edges] = last[u];
                last[u] = edges++;
            }

            void bfs() {
                Arrays.fill(dist, -1);
                int sizeQ = 0;
                for (int u = 0; u < n1; u++) {
                    if (!used[u]) {
                        Q[sizeQ++] = u;
                        dist[u] = 0;
                    }
                }
                for (int i = 0; i < sizeQ; i++) {
                    int u1 = Q[i];
                    for (int e = last[u1]; e >= 0; e = prev[e]) {
                        int u2 = matching[head[e]];
                        if (u2 >= 0 && dist[u2] < 0) {
                            dist[u2] = dist[u1] + 1;
                            Q[sizeQ++] = u2;
                        }
                    }
                }
            }

            boolean dfs(int u1) {
                vis[u1] = true;
                for (int e = last[u1]; e >= 0; e = prev[e]) {
                    int v = head[e];
                    int u2 = matching[v];
                    if (u2 < 0 || ! vis[u2] && dist[u2] == dist[u1] + 1 && dfs(u2)) {
                        matching[v] = u1;
                        used[u1] = true;
                        return true;
                    }
                }
                return false;
            }

            public int maximumMatching() {
                while (true) {
                    bfs();
                    Arrays.fill(vis, false);
                    int f = 0;
                    for (int u = 0; u < n1; ++u) {
                        if (!used[u] && dfs(u)) {
                            ++f;
                        }
                    }
                    if (f == 0) {
                        return res;
                    }
                    res += f;
                }
            }
        }

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[] p = new int[n];
            int[] c = new int[n];
            for (int i = 0; i < n; i++) {
                p[i] = sc.nextInt();
            }
            for (int i = 0; i < n; i++) {
                c[i] = sc.nextInt() - 1;
            }
            HopcraftKarp clubToPotential = new HopcraftKarp(m, 5000, n);
            int d = sc.nextInt();
            boolean[] off = new boolean[n];
            int[] days = new int[d];
            for (int i = 0; i < d; i++) {
                off[days[i] = sc.nextInt() - 1] = true;
            }
            List<Integer>[] pending = new List[5000];
            for (int i = 0; i < 5000; i++) {
                pending[i] = new ArrayList<>();
            }
            for (int i = 0; i < n; i++) {
                if (!off[i]) {
                    pending[p[i]].add(c[i]);
                }
            }
            for (int ci: pending[0]) {
                clubToPotential.addEdge(ci, 0);
            }
            int curPotential = 0;
            int[] ret = new int[d];
            for (int i = 0; i < d; i++) {
                while (clubToPotential.maximumMatching() == curPotential + 1) {
                    curPotential++;
                    for (int ci: pending[curPotential]) {
                        clubToPotential.addEdge(ci, curPotential);
                    }
                }
                ret[d - 1 - i] = curPotential;
                int j = days[d - 1 - i];
                if (p[j] <= curPotential) {
                    clubToPotential.addEdge(c[j], p[j]);
                } else {
                    pending[p[j]].add(c[j]);
                }
            }
            for (int r: ret) {
                pw.println(r);
            }
        }
    }

    // template, actual code is in class Task.
    static long TIME_START, TIME_END;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));

        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
//        System.err.println("Memory increased: " + (usedMemoryAfter - usedMemoryBefore) / 1000000);
//        System.err.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    // Faster IO with BufferedReader wrapped with Scanner
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

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

        public Scanner(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(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 {
            return Double.parseDouble(next());
        }

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