#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 100005;
const long long INF = 1000000000;
struct edge {
  long long a, b, cap, flow;
};
long long n, s, t, d[MAXN], ptr[MAXN], q[MAXN];
vector<edge> e;
vector<long long> g[MAXN];
void add_edge(long long a, long long b, long long cap) {
  edge e1 = {a, b, cap, 0};
  edge e2 = {b, a, 0, 0};
  g[a].push_back((long long)e.size());
  e.push_back(e1);
  g[b].push_back((long long)e.size());
  e.push_back(e2);
}
bool bfs() {
  long long qh = 0, qt = 0;
  q[qt++] = s;
  memset(d, -1, n * sizeof d[0]);
  d[s] = 0;
  while (qh < qt && d[t] == -1) {
    long long v = q[qh++];
    for (size_t i = 0; i < g[v].size(); ++i) {
      long long id = g[v][i], to = e[id].b;
      if (d[to] == -1 && e[id].flow < e[id].cap) {
        q[qt++] = to;
        d[to] = d[v] + 1;
      }
    }
  }
  return d[t] != -1;
}
long long dfs(long long v, long long flow) {
  if (!flow) return 0;
  if (v == t) return flow;
  for (; ptr[v] < (long long)g[v].size(); ++ptr[v]) {
    long long id = g[v][ptr[v]], to = e[id].b;
    if (d[to] != d[v] + 1) continue;
    long long pushed = dfs(to, min(flow, e[id].cap - e[id].flow));
    if (pushed) {
      e[id].flow += pushed;
      e[id ^ 1].flow -= pushed;
      return pushed;
    }
  }
  return 0;
}
long long dinic() {
  long long flow = 0;
  for (;;) {
    if (!bfs()) break;
    memset(ptr, 0, n * sizeof ptr[0]);
    while (long long pushed = dfs(s, INF)) flow += pushed;
  }
  return flow;
}
vector<long long> ext[5005];
long long pt[5005], club[5005], pre[5005], add[5005], lev[5005];
int main() {
  long long std, m, d;
  scanf("%lld %lld", &std, &m);
  for (int i = 1; i < std + 1; i++) scanf("%lld", &pt[i]);
  for (int i = 1; i < std + 1; i++) scanf("%lld", &club[i]);
  scanf("%lld", &d);
  for (int i = 0; i < d; i++) {
    scanf("%lld", &add[i]);
    lev[add[i]] = 1;
  }
  for (int i = 0; i < m; i++) add_edge(0, i + 1, 1);
  for (int i = 0; i < 5000; i++) add_edge(m + 1 + i, 5000 + m, 1);
  s = 0, t = 5000 + m, n = 5000 + m + 1;
  vector<long long> pp;
  long long start = 0;
  for (int i = 1; i < std + 1; i++) {
    if (!lev[i]) {
      if (pt[i] > 0)
        ext[pt[i]].push_back(i);
      else
        add_edge(club[i], m + 1 + pt[i], 1);
    }
  }
  for (int i = d - 1; i >= 0; i--) {
    while (1) {
      bool ok = true;
      if (!dinic()) ok = false;
      if (!ok) break;
      start++;
      for (int j = 0; j < ext[start].size(); j++) {
        long long ss = ext[start][j];
        add_edge(club[ss], m + 1 + pt[ss], 1);
      }
    }
    if (pt[add[i]] > start)
      ext[pt[add[i]]].push_back(add[i]);
    else
      add_edge(club[add[i]], m + 1 + pt[add[i]], 1);
    pp.push_back(start);
  }
  reverse(pp.begin(), pp.end());
  for (int i = 0; i < pp.size(); i++) cout << pp[i] << "\n";
}
