#include <bits/stdc++.h>
struct info {
  int p, c;
};
bool vis[5010];
int check[10010], level = 1, I[5010], pair[10010], result[5010];
info input[5010];
std::vector<int> graph[10010];
bool dfs(int index) {
  check[index] = level;
  for (int i = 0; i < graph[index].size(); i++) {
    int next = graph[index][i];
    if (pair[next] == -1) {
      pair[next] = index;
      return true;
    } else if (check[pair[next]] != level && dfs(pair[next])) {
      pair[next] = index;
      return true;
    }
  }
  return false;
}
int main(void) {
  int n, m, d;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &input[i].p);
  for (int i = 1; i <= n; i++) scanf("%d", &input[i].c);
  scanf("%d", &d);
  for (int i = 1; i <= d; i++) {
    scanf("%d", I + i);
    vis[I[i]] = true;
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == false && input[i].p < m) {
      graph[input[i].p].push_back(input[i].c + m - 1);
    }
  }
  memset(pair, -1, sizeof(pair));
  int r = 0;
  while (r < m && dfs(r)) {
    level++;
    r++;
  }
  for (int i = d; i >= 1; i--) {
    result[i] = r;
    if (input[I[i]].p < m)
      graph[input[I[i]].p].push_back(input[I[i]].c + m - 1);
    level++;
    while (r < m && dfs(r)) {
      level++;
      r++;
    }
  }
  for (int i = 1; i <= d; i++) printf("%d\n", result[i]);
}
