#include <bits/stdc++.h>
using namespace std;
int readInt() {
  int x;
  if (scanf(" %d", &x) == EOF) return -1;
  return x;
}
long long int readLint() {
  long long int x;
  if (cin >> x) return x;
  return -1;
}
string readString() {
  string s;
  if (cin >> s) return s;
  return "";
}
struct SingleCase {
  int clubs, students;
  vector<vector<int> > edge;
  vector<int> match;
  vector<int> vis;
  bool dfs(int u) {
    if (vis[u]) return false;
    vis[u] = true;
    for (int v : edge[u])
      if (match[v] == -1 || dfs(match[v])) {
        match[v] = u;
        return true;
      }
    return false;
  }
  int getBestMatching(int startIdx) {
    for (; startIdx < 5000; startIdx++) {
      vis = vector<int>(5000, 0);
      if (!dfs(startIdx)) break;
    }
    return startIdx;
  }
  bool solveCase() {
    students = readInt();
    if (students < 0) return false;
    clubs = readInt();
    vector<int> potential, initialClub;
    for (int i = 0; i < students; ++i) {
      potential.push_back(readInt());
    }
    for (int i = 0; i < students; ++i) initialClub.push_back(readInt() - 1);
    int queries = readInt();
    vector<int> leaves;
    set<int> left;
    for (int i = 0; i < queries; ++i) {
      leaves.push_back(readInt() - 1);
      left.insert(leaves.back());
    }
    edge = vector<vector<int> >(5000);
    for (int i = 0; i < students; ++i)
      if (!left.count(i)) {
        edge[potential[i]].push_back(initialClub[i]);
      }
    vector<int> ret;
    match = vector<int>(clubs, -1);
    int maxMatch = 0;
    for (int i = leaves.size() - 1; i >= 0; --i) {
      maxMatch = getBestMatching(maxMatch);
      ret.push_back(maxMatch);
      int k = leaves[i];
      edge[potential[k]].push_back(initialClub[k]);
    }
    reverse(ret.begin(), ret.end());
    for (auto& x : ret) cout << x << endl;
    return true;
  }
};
int main() {
  while (SingleCase().solveCase()) {
  };
}
