#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 6;
vector<int> g[MAXN];
int xy[MAXN], yx[MAXN], used[MAXN];
int timer = 1;
bool dfs(int v) {
  if (used[v] == timer) return false;
  used[v] = timer;
  for (auto to : g[v]) {
    if (yx[to] == -1) {
      yx[to] = v;
      xy[v] = to;
      return true;
    }
  }
  for (auto to : g[v]) {
    if (dfs(yx[to])) {
      yx[to] = v;
      xy[v] = to;
      return true;
    }
  }
  return false;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<multiset<int>> cl(m);
  vector<int> c(n), p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    c[i]--;
  }
  int d;
  cin >> d;
  vector<int> todel(d);
  set<int> del;
  for (int i = 0; i < d; i++) {
    cin >> todel[i];
    todel[i]--;
    del.insert(todel[i]);
  }
  for (int i = 0; i < n; i++) {
    if (!del.count(i)) {
      g[p[i]].push_back(c[i]);
    }
  }
  fill(yx, yx + MAXN, -1);
  fill(xy, xy + MAXN, -1);
  int ans = 0;
  vector<int> res(d);
  while (d--) {
    while (dfs(ans)) {
      ans++;
      timer++;
    }
    res[d] = ans;
    int x = todel[d];
    g[p[x]].push_back(c[x]);
    timer++;
  }
  for (auto it : res) cout << it << "\n";
}
