#include <bits/stdc++.h>
namespace my_std {
using namespace std;
inline int read() {
  char c = getchar();
  int ans = 0, f = 1;
  while (c > '9' || c < '0') {
    f ^= (c == '-');
    c = getchar();
  }
  for (; c <= '9' && c >= '0'; c = getchar())
    ans = (ans << 1) + (ans << 3) + (c ^ 48);
  return f ? ans : -ans;
}
const int mod = 1e9 + 7, N = 5010;
inline void inc(int &x, const int &y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int ksm(int x, long long y) {
  int res = 1;
  for (; y; y >>= 1, x = 1ll * x * x % mod)
    if (y & 1) res = 1ll * res * x % mod;
  return res;
}
inline int gcd(int x, int y) {
  if (x > y) swap(y, x);
  return y ? gcd(y, x % y) : x;
}
}  // namespace my_std
using namespace my_std;
vector<int> e[N << 1];
int n, m, d, lv[N], ans[N], wt[N << 1], vis[N << 1];
struct People_CF1139E {
  int pot, cl, lf;
} st[N];
inline bool find(int u) {
  register int v;
  for (register int i = (0); i <= (int(e[u].size()) - 1); ++i) {
    v = e[u][i];
    if (vis[v]) continue;
    vis[v] = 1;
    if (wt[v] == -1 || find(wt[v])) {
      wt[v] = u;
      return 1;
    }
  }
  return 0;
}
int main() {
  n = read(), m = read();
  for (register int i = (1); i <= (n); ++i) st[i].pot = read();
  for (register int i = (1); i <= (n); ++i) st[i].cl = read();
  d = read();
  for (register int i = (1); i <= (d); ++i) lv[i] = read(), st[lv[i]].lf = 1;
  for (register int i = (1); i <= (n); ++i) {
    if (!st[i].lf && st[i].pot <= m) {
      e[st[i].pot].push_back(st[i].cl + m);
      e[st[i].cl + m].push_back(st[i].pot);
    }
  }
  memset(wt, -1, sizeof(wt));
  for (register int i = (d); i >= (1); --i) {
    for (register int j = (ans[i + 1]); j <= (m); ++j) {
      memset(vis, 0, sizeof(vis));
      if (!find(j)) {
        ans[i] = j;
        break;
      }
    }
    if (st[lv[i]].pot > m) continue;
    e[st[lv[i]].pot].push_back(st[lv[i]].cl + m);
    e[st[lv[i]].cl + m].push_back(st[lv[i]].pot);
  }
  for (register int i = (1); i <= (d); ++i) printf("%d\n", ans[i]);
  return 0;
}
