#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 20;
int n = 0, m = 0;
int a, k;
int b;
int val[N];
int p[N], q[N];
bool vis[N + N];
int link[N + N + 1];
vector<int> g[N + N];
int ans[N];
bool dfs(int u) {
  for (auto v : g[u]) {
    if (vis[v]) continue;
    vis[v] = true;
    if (link[v] == -1 || dfs(link[v])) {
      link[v] = u;
      return true;
    }
  }
  return false;
}
void printg() {
  cout << "  G:  \n";
  for (int i = 0; i <= n; i++) {
    for (auto v : g[i]) {
      cout << i << " <=> " << v << endl;
    }
  }
  cout << "\n\n";
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  cin >> k;
  for (int i = 1; i <= k; i++) scanf("%d", &q[i]), vis[q[i]] = true;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    g[val[i]].push_back(N + p[i]), g[N + p[i]].push_back(val[i]);
  }
  for (int i = 0; i <= N + N; i++) link[i] = -1;
  for (int i = 0; i <= m; i++) {
    memset(vis, 0, sizeof(vis));
    if (dfs(i))
      ans[k]++;
    else
      break;
  }
  for (int i = k; i >= 2; i--) {
    memset(vis, 0, sizeof(vis));
    g[val[q[i]]].push_back(N + p[q[i]]), g[N + p[q[i]]].push_back(val[q[i]]);
    ans[i - 1] = ans[i];
    while (dfs(ans[i - 1])) {
      ans[i - 1]++;
      memset(vis, 0, sizeof(vis));
    }
  }
  for (int i = 1; i <= k; i++) cout << ans[i] << endl;
}
