#include <bits/stdc++.h>
using namespace std;
static constexpr int N = 5000 + 5;
class Dinic {
 private:
  using CapT = int64_t;
  struct Edge {
    int to, rev;
    CapT cap;
  };
  CapT mf_ret;
  int n, st, ed;
  vector<vector<Edge>> G;
  vector<int> lv;
  bool BFS() {
    fill(lv.begin(), lv.end(), -1);
    queue<int> bfs;
    bfs.push(st);
    lv[st] = 0;
    while (!bfs.empty()) {
      int u = bfs.front();
      bfs.pop();
      for (auto e : G[u]) {
        if (e.cap <= 0 or lv[e.to] != -1) continue;
        lv[e.to] = lv[u] + 1;
        bfs.push(e.to);
      }
    }
    return (lv[ed] != -1);
  }
  CapT DFS(int u, CapT f) {
    if (u == ed) return f;
    CapT ret = 0;
    for (auto& e : G[u]) {
      if (e.cap <= 0 or lv[e.to] != lv[u] + 1) continue;
      CapT nf = DFS(e.to, min(f, e.cap));
      ret += nf;
      e.cap -= nf;
      f -= nf;
      G[e.to][e.rev].cap += nf;
      if (f == 0) return ret;
    }
    if (ret == 0) lv[u] = -1;
    return ret;
  }

 public:
  void init(int n_, int st_, int ed_) {
    mf_ret = 0;
    n = n_, st = st_, ed = ed_;
    G.resize(n);
    lv.resize(n);
    fill(G.begin(), G.end(), vector<Edge>());
  }
  void add_edge(int u, int v, CapT c) {
    G[u].push_back({v, (int)(G[v].size()), c});
    G[v].push_back({u, (int)(G[u].size()) - 1, 0});
  }
  CapT max_flow() {
    while (BFS()) {
      CapT f = DFS(st, numeric_limits<CapT>::max());
      mf_ret += f;
      if (f == 0) break;
    }
    return mf_ret;
  }
} flow;
int a[N], b[N], q[N];
bool sad[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] = min(a[i], n + 1);
  }
  for (int i = 1; i <= n; ++i) cin >> b[i];
  int qc;
  cin >> qc;
  for (int i = 1; i <= qc; ++i) {
    cin >> q[i];
    sad[q[i]] = true;
  }
  const int S = 0, T = n + m + 3;
  flow.init(T + 1, S, T);
  for (int i = 1; i <= m; ++i) flow.add_edge(S, i, 1);
  for (int i = 1; i <= n; ++i)
    if (not sad[i]) flow.add_edge(b[i], m + 1 + a[i], 1);
  vector<int> ans;
  ans.reserve(qc);
  int mex = 0;
  while (flow.max_flow() == mex) flow.add_edge(mex++ + m + 1, T, 1);
  ans.push_back(mex);
  for (int i = qc; i >= 2; --i) {
    flow.add_edge(b[q[i]], m + 1 + a[q[i]], 1);
    while (flow.max_flow() == mex) flow.add_edge(mex++ + m + 1, T, 1);
    ans.push_back(mex);
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < qc; ++i) cout << ans[i] - 1 << '\n';
  return 0;
}
