#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int match[maxn], a[maxn];
int k[maxn], p[maxn], vis[maxn];
int n, m, d, b[maxn];
vector<int> v[maxn];
vector<int> ans;
int dfs(int x) {
  for (auto u : v[x])
    if (!vis[u]) {
      vis[u] = 1;
      if (match[u] == -1 || dfs(match[u])) {
        match[u] = x;
        return 1;
      }
    }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(match, -1, sizeof(match));
  cin >> n >> m;
  for (int i = (0); i < (n); i++) cin >> p[i];
  for (int i = (0); i < (n); i++) cin >> a[i];
  cin >> d;
  for (int i = (0); i < (d); i++) cin >> k[i], b[--k[i]] = 1;
  for (int i = (0); i < (n); i++)
    if (!b[i]) {
      v[p[i]].push_back(a[i]);
    }
  int t = 0;
  for (int i = d - 1; i >= 0; i--) {
    while (1) {
      memset(vis, 0, sizeof(vis));
      if (dfs(t))
        t++;
      else
        break;
    }
    ans.push_back(t);
    v[p[k[i]]].push_back(a[k[i]]);
  }
  for (int i = (int)ans.size() - 1; i >= 0; i--) {
    cout << ans[i] << "\n";
  }
  return 0;
}
