#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int inf = 1 << 30;
const int maxn = 1e4 + 5;
inline void fastio() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int n, m, d, p[maxn], c[maxn], ans[maxn], o[maxn], del[maxn];
int match[maxn], vis[maxn];
vector<int> g[maxn];
bool dfs(int u, int id) {
  for (int v : g[u])
    if (vis[v] != id) {
      vis[v] = id;
      if (!match[v] || dfs(match[v], id)) {
        match[v] = u;
        return 1;
      }
    }
  return 0;
}
int main() {
  fastio();
  cin >> n >> m;
  for (int i = (1); i <= (n); i++) cin >> p[i];
  for (int i = (1); i <= (n); i++) cin >> c[i];
  cin >> d;
  for (int i = (1); i <= (d); i++) {
    cin >> o[i];
    del[o[i]] = 1;
  }
  int base = m + 1;
  for (int i = (1); i <= (n); i++)
    if (!del[i]) {
      g[c[i]].push_back(p[i] + base);
      g[p[i] + base].push_back(c[i]);
    }
  int res = 0, id = 0;
  for (int i = (d); i >= (1); i--) {
    while (dfs(res + base, ++id)) res++;
    ans[i] = res;
    g[c[o[i]]].push_back(p[o[i]] + base);
    g[p[o[i]] + base].push_back(c[o[i]]);
  }
  for (int i = (1); i <= (d); i++) cout << ans[i] << endl;
  return 0;
}
