#include <bits/stdc++.h>
using namespace std;
inline int read();
const int maxn = 5000 + 100;
int n, m, d, c, cnt;
int he[maxn], ne[maxn], to[maxn];
int p[maxn], in[maxn], out[maxn], match[maxn], ans[maxn], vis[maxn];
bool away[maxn];
void Add_Edge(int x, int y) {
  ne[++c] = he[x];
  he[x] = c;
  to[c] = y;
}
bool Dfs(int dfn, int x) {
  for (int i = he[x], j; i; i = ne[i]) {
    if (vis[j = to[i]] == dfn) continue;
    vis[j] = dfn;
    if (match[j] && !Dfs(dfn, match[j])) continue;
    match[j] = x;
    return true;
  }
  return false;
}
void Work() {
  n = read(), m = read();
  for (int i = 1; i <= n; ++i) p[i] = read() + 1;
  for (int i = 1; i <= n; ++i) in[i] = read();
  d = read();
  for (int i = 1; i <= d; ++i) {
    out[i] = read();
    away[out[i]] = 1;
  }
  for (int i = 1; i <= n; ++i)
    if (!away[i]) Add_Edge(p[i], in[i]);
  for (int i = d, ok = 0; i >= 1; --i) {
    while (Dfs(++cnt, ok + 1)) ++ok;
    ans[i] = ok;
    Add_Edge(p[out[i]], in[out[i]]);
  }
  for (int i = 1; i <= d; ++i) printf("%d\n", ans[i]);
}
int main() {
  Work();
  return 0;
}
inline int read() {
  char c;
  bool type = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') type = 0;
  int ans = c ^ 48;
  while ((c = getchar()) >= '0' && c <= '9')
    ans = (ans << 3) + (ans << 1) + (c ^ 48);
  return type ? ans : -ans;
}
