#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int maxn = 1e4 + 6;
int n, m, D, tot, cnt = 0, base = 5000, link[maxn], last[maxn], val[maxn],
                  group[maxn], le[maxn], ans[maxn], vis[maxn];
bool tmp[maxn];
struct edge {
  int to, next;
} e[maxn << 1];
void insert(int u, int v) {
  e[++cnt] = (edge){v, last[u]};
  last[u] = cnt;
}
inline bool dfs(int x) {
  for (int i = last[x]; i; i = e[i].next) {
    if (vis[e[i].to] == tot) continue;
    vis[e[i].to] = tot;
    if (link[e[i].to] == -1 || dfs(link[e[i].to])) {
      link[e[i].to] = x;
      return 1;
    }
  }
  return 0;
}
inline int calc(int x) {
  for (int i = x; i <= maxn - 1; i++) {
    if (link[i] == -1) {
      tot++;
      if (!dfs(i)) return i;
    }
  }
}
int main() {
  for (int i = 0; i <= maxn - 1; i++) link[i] = -1;
  n = read(), m = read();
  for (int i = 1; i <= n; i++) val[i] = read();
  for (int i = 1; i <= n; i++) group[i] = read();
  D = read();
  for (int i = 1; i <= D; i++) tmp[le[i] = read()] = 1;
  for (int i = 1; i <= n; i++)
    if (!tmp[i]) insert(val[i], group[i] + base);
  for (int i = D; i >= 1; i--) {
    ans[i] = calc(ans[i + 1]);
    int idx = le[i];
    insert(val[idx], group[idx] + base);
  }
  for (int i = 1; i <= D; i++) printf("%d\n", ans[i]);
  return 0;
}
