#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
struct edge {
  int to, next;
} e[maxn];
int head[maxn], cnt;
void add(int u, int v) {
  e[cnt].to = v;
  e[cnt].next = head[u];
  head[u] = cnt++;
}
int n, m, d;
int p[maxn], c[maxn], D[maxn], ans[maxn], match[maxn];
bool vis[maxn], use[maxn];
bool pd(int x) {
  if (use[x]) return 0;
  use[x] = 1;
  for (int i = head[x]; i != -1; i = e[i].next) {
    int v = e[i].to;
    if (match[v] == -1 || pd(match[v])) {
      match[v] = x;
      return 1;
    }
  }
  return 0;
}
int main() {
  memset(head, -1, sizeof(head));
  memset(match, -1, sizeof(match));
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  scanf("%d", &d);
  for (int i = 1; i <= d; i++) scanf("%d", &D[i]), vis[D[i]] = 1;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) add(p[i], c[i]);
  int t = 0;
  for (int i = d; i >= 1; i--) {
    memset(use, 0, sizeof(use));
    while (pd(t)) {
      memset(use, 0, sizeof(use));
      t++;
    }
    ans[i] = t;
    add(p[D[i]], c[D[i]]);
  }
  for (int i = 1; i <= d; i++) printf("%d\n", ans[i]);
  return 0;
}
