#include <bits/stdc++.h>
using namespace std;
int match[5123];
vector<int> v[5123];
bool bpm(int u, bool seen[]) {
  if (!v[u].empty()) {
    for (auto i : v[u]) {
      if (!seen[i]) {
        seen[i] = 1;
        if (match[i] < 0 || bpm(match[i], seen)) {
          match[i] = u;
          return true;
        }
      }
    }
  }
  return false;
}
int solve(int curr, int m) {
  bool seen[5123];
  memset(seen, 0, sizeof(seen));
  while (curr < m && bpm(curr, seen)) {
    curr++;
    memset(seen, 0, sizeof(seen));
  }
  return curr;
}
int main() {
  int n, m, p[5123], c[5123], d, k[5123], ans[5123];
  bool isAdd[5123];
  memset(isAdd, 1, sizeof(isAdd));
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  cin >> d;
  for (int i = 0; i < d; i++) {
    cin >> k[i];
    k[i]--;
    isAdd[k[i]] = false;
  }
  for (int i = 0; i < n; i++)
    if (isAdd[i]) v[p[i]].push_back(c[i]);
  memset(match, -1, sizeof(match));
  ans[d - 1] = solve(0, m);
  for (int i = d - 1; i > 0; i--) {
    v[p[k[i]]].push_back(c[k[i]]);
    ans[i - 1] = solve(ans[i], m);
  }
  for (int i = 0; i < d; i++) cout << ans[i] << endl;
  return 0;
}
