#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int n, m, p[maxn], c[maxn], d, k[maxn], ans[maxn];
int head[maxn], ecnt;
struct edge {
  int to, next;
} e[maxn * 100];
int vis[maxn], match[maxn], fl[maxn];
void adde(int u, int v) {
  e[++ecnt].to = v;
  e[ecnt].next = head[u];
  head[u] = ecnt;
}
int dfs(int u) {
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (vis[v]) continue;
    vis[v] = 1;
    if (match[v] == -1 || dfs(match[v])) {
      match[v] = u;
      return 1;
    }
  }
  return 0;
}
int read() {
  int res = 0, f = 1;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = -1;
  } while (!isdigit(ch));
  do {
    res = res * 10 + ch - '0';
    ch = getchar();
  } while (isdigit(ch));
  return res * f;
}
int solve(int x) {
  for (int i = (x); i <= (m + 1); ++i) {
    memset(vis, 0, sizeof(vis));
    if (!dfs(i)) return i;
  }
  return 0;
}
signed main() {
  n = read();
  m = read();
  memset(match, -1, sizeof(match));
  for (int i = (1); i <= (n); ++i) p[i] = read();
  for (int i = (1); i <= (n); ++i) c[i] = read();
  d = read();
  for (int i = (1); i <= (d); ++i) fl[k[i] = read()] = 1;
  for (int i = (1); i <= (n); ++i)
    if (!fl[i]) adde(p[i], c[i]);
  ans[d] = solve(0);
  adde(p[k[d]], c[k[d]]);
  for (int i = (d - 1); i >= (1); --i)
    ans[i] = solve(ans[i + 1]), adde(p[k[i]], c[k[i]]);
  for (int i = (1); i <= (d); ++i) printf("%d\n", ans[i]);
}
