#include <bits/stdc++.h>
using namespace std;
class BipartiteMaxMatch {
 public:
  static const long long Maxl = 5e3 + 10, Maxr = 5e3 + 10, N = 5e3 + 10;
  long long L, R, left[Maxl], right[Maxr], vis[Maxr];
  long long no[N], p[N], c[N], k[N], ans[N], d;
  vector<vector<long long> > g;
  BipartiteMaxMatch(long long l, long long r) {
    g.resize(l + 1), L = l, R = r;
    for (long long i = 0; i <= L; i++) left[i] = -1;
    for (long long i = 0; i <= R; i++) right[i] = -1;
  }
  void AddEdge(long long u, long long v) { g[u].push_back(v); }
  void match() {
    long long mex = -1;
    for (long long i = d; i > 0; i--) {
      while (true && mex + 1 <= L) {
        if (left[mex + 1] == -1) {
          memset(vis, 0, sizeof(vis));
          if (!dfs(mex + 1)) break;
        }
        mex++;
      }
      if (p[k[i]] < R) AddEdge(p[k[i]], c[k[i]]);
      ans[i] = mex + 1;
    }
  }
  bool dfs(long long v) {
    for (auto u : g[v]) {
      if (vis[u]) continue;
      vis[u] = 1;
      if (right[u] == -1 || dfs(right[u])) {
        left[v] = u, right[u] = v;
        return 1;
      }
    }
    return 0;
  }
  void print() {
    for (long long i = 1; i <= d; i++) {
      cout << ans[i] << '\n';
    }
  }
};
void solve() {
  long long n, m;
  cin >> n >> m;
  BipartiteMaxMatch *bi = new BipartiteMaxMatch(m - 1, m);
  for (long long i = 1; i <= n; i++) {
    cin >> bi->p[i];
  }
  for (long long j = 1; j <= n; j++) {
    cin >> bi->c[j];
  }
  cin >> bi->d;
  for (long long i = 1; i <= (bi->d); i++) {
    cin >> bi->k[i];
    bi->no[bi->k[i]] = 1;
  }
  for (long long i = 1; i <= n; i++) {
    if (!(bi->no[i]) && bi->p[i] < m) bi->AddEdge(bi->p[i], bi->c[i]);
  }
  bi->match();
  bi->print();
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  clock_t start, end;
  start = clock();
  cout << fixed << setprecision(8);
  while (t--) {
    solve();
  }
  end = clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
}
