#include <bits/stdc++.h>
using namespace std;
const int maxn = 20005;
const int maxm = 100005;
const int inf = 0x3f3f3f3f;
struct Edge {
  int to, nxt, cap, flow;
} edge[maxm];
int tol;
int head[maxn];
void init() {
  tol = 2;
  memset(head, -1, sizeof(head));
}
void AddEdge(int u, int v, int w, int rw = 0) {
  edge[tol].to = v;
  edge[tol].cap = w;
  edge[tol].flow = 0;
  edge[tol].nxt = head[u];
  head[u] = tol++;
  edge[tol].to = u;
  edge[tol].cap = rw;
  edge[tol].flow = 0;
  edge[tol].nxt = head[v];
  head[v] = tol++;
}
int Q[maxn];
int dep[maxn], cur[maxn], sta[maxn];
bool bfs(int s, int t, int n) {
  int front = 0, tail = 0;
  memset(dep, -1, sizeof(dep[0]) * (n + 1));
  dep[s] = 0;
  Q[tail++] = s;
  while (front < tail) {
    int u = Q[front++];
    for (int i = head[u]; i != -1; i = edge[i].nxt) {
      int v = edge[i].to;
      if (edge[i].cap > edge[i].flow && dep[v] == -1) {
        dep[v] = dep[u] + 1;
        if (v == t) return true;
        Q[tail++] = v;
      }
    }
  }
  return false;
}
int dinic(int s, int t, int n) {
  int maxflow = 0;
  while (bfs(s, t, n)) {
    for (int i = 0; i < n; i++) cur[i] = head[i];
    int u = s, tail = 0;
    while (cur[s] != -1) {
      if (u == t) {
        int tp = inf;
        for (int i = tail - 1; i >= 0; i--) {
          tp = min(tp, edge[sta[i]].cap - edge[sta[i]].flow);
        }
        maxflow += tp;
        for (int i = tail - 1; i >= 0; i--) {
          edge[sta[i]].flow += tp;
          edge[sta[i] ^ 1].flow -= tp;
          if (edge[sta[i]].cap - edge[sta[i]].flow == 0) tail = i;
        }
        u = edge[sta[tail] ^ 1].to;
      } else if (cur[u] != -1 && edge[cur[u]].cap > edge[cur[u]].flow &&
                 dep[u] + 1 == dep[edge[cur[u]].to]) {
        sta[tail++] = cur[u];
        u = edge[cur[u]].to;
      } else {
        while (u != s && cur[u] == -1) u = edge[sta[--tail] ^ 1].to;
        cur[u] = edge[cur[u]].nxt;
      }
    }
  }
  return maxflow;
}
int p[5005], c[5005];
int le[5005];
bool vis[5005];
int aans[5005];
int main() {
  int m, n;
  init();
  scanf("%d%d", &n, &m);
  int maxn = 0;
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    maxn = max(maxn, p[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
  }
  int d;
  scanf("%d", &d);
  for (int i = 1; i <= d; i++) {
    scanf("%d", &le[i]);
    vis[le[i]] = true;
  }
  int s = 0, t = 5000 + m + 2;
  for (int i = 1; i <= m; i++) AddEdge(s, i, 1);
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    AddEdge(c[i], p[i] + m + 1, 1);
  }
  int ans = 1;
  AddEdge(m + 1, t, 1);
  int f = 0;
  for (int i = d; i >= 1; i--) {
    while (true) {
      f = dinic(s, t, t + 2) + f;
      if (ans != f) break;
      AddEdge(ans + m + 1, t, 1);
      ans++;
    }
    AddEdge(c[le[i]], p[le[i]] + m + 1, 1);
    aans[i] = ans - 1;
  }
  for (int i = 1; i <= d; i++) {
    cout << aans[i] << endl;
  }
}
