#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
int N, M;
int P[5011];
int C[5011];
int K[5011], D;
bool leave[5011];
vector<int> G[5011];
bool use[5011], act[5011];
int match[5011];
int ans[5011];
bool dfs(int v) {
  if (use[v]) return false;
  use[v] = true;
  for (int i = 0; i < (int)G[v].size(); i++) {
    int u = G[v][i];
    if (match[u] == -1 || dfs(match[u])) {
      match[u] = v;
      return true;
    }
  }
  return false;
}
void MAIN() {
  scanf("%d%d", &N, &M);
  for (int i = 0, i_len = (N); i < i_len; ++i) scanf("%d", P + i);
  for (int i = 0, i_len = (N); i < i_len; ++i) scanf("%d", C + i), C[i]--;
  scanf("%d", &D);
  for (int j = 0, j_len = (D); j < j_len; ++j) {
    scanf("%d", K + j);
    K[j]--;
    leave[K[j]] = true;
  }
  for (int i = 0, i_len = (N); i < i_len; ++i)
    if (!leave[i]) {
      G[P[i]].push_back(C[i]);
    }
  memset(match, -1, sizeof match);
  int power = 0;
  for (int j = D; j--;) {
    memset(use, 0, sizeof use);
    while (dfs(power)) {
      power++;
      memset(use, 0, sizeof use);
    }
    ans[j] = power;
    int i = K[j];
    G[P[i]].push_back(C[i]);
  }
  for (int j = 0, j_len = (D); j < j_len; ++j) printf("%d\n", ans[j]);
}
int main() {
  int TC = 1;
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}
