#include <bits/stdc++.h>
using namespace std;
const int MAXO = 10005;
int node, edge;
int src, des;
vector<int> adjl[10005];
vector<int> rc[10005];
vector<int> rev_idx[10005];
void add_edge(int u, int v, int w) {
  adjl[u].push_back(v);
  adjl[v].push_back(u);
  rc[u].push_back(w);
  rc[v].push_back(0);
  rev_idx[u].push_back(adjl[v].size() - 1);
  rev_idx[v].push_back(adjl[u].size() - 1);
}
int lev[10005];
int vis[10005];
bool dinic_bfs() {
  memset(vis, 0, sizeof(vis));
  memset(lev, 0, sizeof(lev));
  lev[src] = 0;
  vis[src] = 1;
  queue<int> myq;
  myq.push(src);
  while (!myq.empty()) {
    int u = myq.front();
    myq.pop();
    int sz = adjl[u].size();
    for (int i = 0; i <= sz - 1; i++) {
      int v = adjl[u][i];
      if (rc[u][i] == 0) {
        continue;
      }
      if (vis[v] == 0) {
        vis[v] = 1;
        lev[v] = lev[u] + 1;
        myq.push(v);
      }
    }
  }
  if (vis[des]) {
    return 1;
  }
  return 0;
}
int shuru[10005];
int dinic_dfs(int u, int flow) {
  if (u == des) {
    return flow;
  }
  for (int i = shuru[u]; i <= (int)adjl[u].size() - 1; i++) {
    shuru[u] = i;
    int v = adjl[u][i];
    if ((lev[v] == lev[u] + 1) && (rc[u][i])) {
      int ff = dinic_dfs(v, min(flow, rc[u][i]));
      if (ff) {
        rc[u][i] -= ff;
        rc[v][rev_idx[u][i]] += ff;
        return ff;
      }
    }
  }
  shuru[u] = adjl[u].size();
  return 0;
}
int dinic() {
  int ans = 0;
  while (dinic_bfs()) {
    memset(shuru, 0, sizeof(shuru));
    while (1) {
      int ff = dinic_dfs(src, MAXO);
      if (ff == 0) break;
      ans += ff;
    }
  }
  return ans;
}
int n, m, po[10005], cl[10005], ara[10005], can[10005];
vector<int> mat[10005];
int getPotId(int v) { return v + m + 3; }
int getClubId(int v) { return v + 2; }
int prin[10005];
void update(int mex) {
  for (auto x : mat[mex]) add_edge(getPotId(mex), getClubId(x), 1);
  mat[mex].clear();
}
int main() {
  ios::sync_with_stdio(false);
  int d;
  cin >> n >> m;
  for (int i = 0; i <= n - 1; i++) cin >> po[i];
  for (int i = 0; i <= n - 1; i++) cin >> cl[i];
  cin >> d;
  for (int i = 0; i <= d - 1; i++) cin >> ara[i], can[ara[i] - 1] = 1;
  src = 0;
  des = 1;
  int mex = 0, did = 0;
  for (int i = 1; i <= m; i++) add_edge(getClubId(i), des, 1);
  add_edge(src, getPotId(mex), 1);
  for (int i = 0; i <= n - 1; i++) {
    if (can[i]) continue;
    int pot = po[i], clb = cl[i];
    mat[pot].push_back(clb);
  }
  for (int i = d - 1; i >= 0; i--) {
    update(mex);
    while (dinic()) {
      mex++;
      add_edge(src, getPotId(mex), 1);
      update(mex);
    }
    prin[i] = mex;
    int p = ara[i];
    p--;
    int pot = po[p], clb = cl[p];
    if (pot <= mex)
      add_edge(getPotId(pot), getClubId(clb), 1);
    else {
      mat[pot].push_back(clb);
    }
  }
  for (int i = 0; i <= d - 1; i++) cout << prin[i] << endl;
  return 0;
}
