#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
vector<int> v[maxn];
int p[maxn], c[maxn];
int link[maxn];
bool vis[maxn], ban[maxn];
inline bool dfs(int s) {
  for (int i = 0; i < v[s].size(); i++) {
    int t = v[s][i];
    if (vis[t]) continue;
    vis[t] = true;
    if (link[t] == -1 || dfs(link[t])) {
      link[t] = s;
      return true;
    }
  }
  return false;
}
vector<int> que, ans;
int main() {
  memset(link, -1, sizeof link);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  int d;
  cin >> d;
  for (int i = 1, x; i <= d; i++) {
    cin >> x;
    ban[x] = true;
    que.push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (ban[i]) continue;
    v[p[i]].push_back(c[i]);
  }
  int num = 0;
  for (int i = que.size() - 1; i >= 0; i--) {
    while (true) {
      memset(vis, false, sizeof vis);
      if (dfs(num))
        num++;
      else
        break;
    }
    ans.push_back(num);
    int x = que[i];
    v[p[x]].push_back(c[x]);
  }
  for (int i = ans.size() - 1; i >= 0; i--) cout << ans[i] << endl;
  return 0;
}
