#include <bits/stdc++.h>
using namespace std;
const int maxn = 10010;
inline int read() {
  char ch = getchar();
  int x = 0, f = 0;
  while (ch < '0' || ch > '9') f |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return f ? -x : x;
}
int n, m, p[maxn], c[maxn], d, k[maxn], with[maxn], el, head[maxn], to[maxn],
    nxt[maxn], tmp, ans[maxn];
bool vis[maxn], del[maxn];
inline void add(int u, int v) {
  to[++el] = v;
  nxt[el] = head[u];
  head[u] = el;
}
bool dfs(int u) {
  if (vis[u]) return false;
  vis[u] = true;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = to[i];
    if (with[v] == -1 || dfs(with[v])) {
      with[u] = v;
      with[v] = u;
      return true;
    }
  }
  return false;
}
int main() {
  memset(with, -1, sizeof(with));
  n = read();
  m = read();
  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++) del[k[i] = read()] = true;
  for (int i = (1); i <= (n); i++)
    if (!del[i] && p[i] < m) add(p[i], c[i] + m), add(c[i] + m, p[i]);
  for (int i = (d); i >= (1); i--) {
    memset(vis, 0, sizeof(vis));
    while (dfs(tmp)) tmp++, memset(vis, 0, sizeof(vis));
    ans[i] = tmp;
    if (p[k[i]] < m) add(p[k[i]], c[k[i]] + m), add(c[k[i]] + m, p[k[i]]);
  }
  for (int i = (1); i <= (d); i++) printf("%d\n", ans[i]);
}
