#include <bits/stdc++.h>
using namespace std;
template <class T>
int read(T& x) {
  int c = getchar(), f = (x = 0);
  while (~c && (c < 48 || c > 57)) {
    if (c == '-') {
      f = 1;
    }
    c = getchar();
  }
  if (!~c) {
    return 0;
  }
  while (c > 47 && c < 58) {
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  }
  if (f) {
    x = -x;
  }
  return 1;
}
template <class T, class U>
inline int read(T& a, U& b) {
  return read(a) && read(b);
}
template <class T, class U, class V>
inline int read(T& a, U& b, V& c) {
  return read(a) && read(b) && read(c);
}
inline int read(double& _, double& __) { return scanf("%lf%lf", &_, &__); }
inline int read(char* _) { return scanf("%s", _); }
inline int read(double& _) { return scanf("%lf", &_); }
inline void println(long long _) { printf("%lld\n", _); }
inline void println(int _) { printf("%d\n", _); }
inline void println(long long _, long long __) { printf("%lld %lld\n", _, __); }
inline void println(int _, int __) { printf("%d %d\n", _, __); }
inline void println(double& __, int _) { printf("%.*lf\n", _, __); }
template <class T>
inline void cmax(T& _, T __) {
  if (_ < __) _ = __;
}
template <class T>
inline void cmin(T& _, T __) {
  if (_ > __) _ = __;
}
const int maxn = 5e3 + 10, INF = 0x3f3f3f3f;
const long long LINF = (long long)INF << 32 | INF;
int link[maxn], ans[maxn];
bool vis[maxn];
vector<int> G[maxn];
int p[maxn], c[maxn], d[maxn], D;
bool leave[maxn];
bool DFS(int u) {
  for (auto v : G[u])
    if (!vis[v]) {
      vis[v] = true;
      if (link[v] == -1 || DFS(link[v])) {
        link[v] = u;
        return true;
      }
    }
  return false;
}
int main() {
  int n, m, cur = 0;
  memset(link, -1, sizeof(link));
  read(n, m);
  for (int i = 1; i <= (n); i++) read(p[i]);
  for (int i = 1; i <= (n); i++) read(c[i]);
  read(D);
  for (int i = 1; i <= (D); i++) read(d[i]), leave[d[i]] = true;
  for (int i = 1; i <= (n); i++)
    if (!leave[i]) G[p[i]].push_back(c[i]);
  for (int i = D; i >= (1); i--) {
    memset(vis, false, sizeof(vis));
    while (DFS(cur)) memset(vis, false, sizeof(vis)), cur++;
    ans[i] = cur;
    G[p[d[i]]].push_back(c[d[i]]);
  }
  for (int i = 1; i <= (D); i++) println(ans[i]);
  return 0;
}
