#include <bits/stdc++.h>
struct flow {
  int head[1000001], next[1000001], to[1000001], fl[1000001], N, E,
      dep[1000001];
  inline void add(int u, int v, int f) {
    next[E] = head[u], to[E] = v, fl[E] = f, head[u] = E++;
    next[E] = head[v], to[E] = u, fl[E] = 0, head[v] = E++;
  }
  void clear(int n) {
    for (int i = 0; i < n; i++) head[i] = -1;
    N = n, E = 0;
  }
  bool BFS() {
    static int q[1000001];
    for (int i = 0; i < N; i++) dep[i] = 0;
    int H = 0, T = 1, u;
    q[1] = 0;
    dep[0] = 1;
    while (H < T)
      for (int e = head[u = q[++H]]; ~e; e = next[e])
        if (fl[e] && !dep[to[e]]) {
          dep[q[++T] = to[e]] = dep[u] + 1;
          if (to[e] == N - 1) return 1;
        }
    return 0;
  }
  int DFS(int p, int f) {
    if (p == N - 1) return f;
    int u = 0, y;
    for (int e = head[p]; ~e; e = next[e])
      if (fl[e] && dep[to[e]] == dep[p] + 1 &&
          (y = DFS(to[e], std::min(f, fl[e])))) {
        u += y;
        f -= y;
        fl[e] -= y;
        fl[e ^ 1] += y;
        if (!f) return u;
      }
    if (!u) dep[p] = 0;
    return u;
  }
  int operator()() {
    int r = 0;
    while (BFS()) r += DFS(0, 1000000000);
    return r;
  }
} G;
int N, M, p[5001], c[5001], del[5001], D, k[5001], O[5001];
std::vector<int> C[5001];
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) {
    scanf("%d", p + i);
    C[++p[i]].push_back(i);
  }
  for (int i = 1; i <= N; i++) scanf("%d", c + i);
  scanf("%d", &D);
  for (int i = 1; i <= D; i++) {
    scanf("%d", k + i);
    del[k[i]] = 1;
  }
  G.clear(1 + M + N + 5000 + 1);
  for (int i = 1; i <= M; i++) G.add(0, i, 1);
  for (int i = 1; i <= N; i++)
    if (!del[i]) G.add(c[i], M + i, 1);
  int try_ans = 1;
  for (int i : C[try_ans]) G.add(M + i, M + N + try_ans, 1);
  G.add(M + N + try_ans, G.N - 1, 1);
  for (int i = D; i; i--) {
    while (G()) {
      try_ans++;
      for (int i : C[try_ans]) G.add(M + i, M + N + try_ans, 1);
      G.add(M + N + try_ans, G.N - 1, 1);
    }
    O[i] = try_ans - 1;
    G.add(c[k[i]], M + k[i], 1);
  }
  for (int i = 1; i <= D; i++) printf("%d\n", O[i]);
  return 0;
}
