#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long int LINF = 1LL * INF * INF;
const int MAXN = 2e5 + 10;
const int MAXM = 5e3 + 10;
priority_queue<int> pq;
vector<vector<int> > graph;
vector<vector<int> > addedge;
queue<int> que;
int A[MAXM];
int B[MAXM];
int P[MAXM];
int C[MAXM];
int query[MAXM];
int ans[MAXM];
bool remain[MAXM];
bool visited[MAXM];
void add(int x) {
  for (int i = 0; i < addedge[x].size(); i++) {
    graph[x].push_back(addedge[x][i]);
  }
  return;
}
bool dfs(int a) {
  visited[a] = true;
  for (int b : graph[a]) {
    if (B[b] == -1 || (!visited[B[b]] && dfs(B[b]))) {
      A[a] = b;
      B[b] = a;
      return true;
    }
  }
  return false;
}
int main() {
  int n, m, k, a, b, x, y;
  int sum = 0;
  int cnt = 0;
  int mx = 0;
  int mn = INF;
  int idx = -1;
  cin >> n >> m;
  graph = vector<vector<int> >(MAXM);
  addedge = vector<vector<int> >(MAXM);
  for (int i = 1; i <= n; i++) cin >> P[i];
  for (int i = 1; i <= n; i++) cin >> C[i];
  cin >> k;
  fill(remain, remain + n + 1, true);
  for (int i = 1; i <= k; i++) {
    cin >> query[i];
    remain[query[i]] = false;
  }
  for (int i = 1; i <= n; i++) {
    if (!remain[i]) continue;
    addedge[P[i]].push_back(C[i]);
  }
  int cur = -1;
  add(0);
  fill(A, A + MAXM, -1);
  fill(B, B + MAXM, -1);
  for (int runs = k; runs >= 1; runs--) {
    while (true) {
      fill(visited, visited + MAXM, false);
      if (!dfs(cur + 1)) break;
      cur++;
      add(cur + 1);
    }
    ans[runs] = cur + 1;
    if (cur + 1 >= P[query[runs]])
      graph[P[query[runs]]].push_back(C[query[runs]]);
    else
      addedge[P[query[runs]]].push_back(C[query[runs]]);
  }
  for (int i = 1; i <= k; i++) cout << ans[i] << "\n";
  return 0;
}
