#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    que;
stringstream ssin;
const long long LINF = 0x7fffffffffffffffll;
const int N = 4e5 + 5, M = 4e5 + 5, mod = 1e9 + 7, INF = 0x3f3f3f3f;
int n, m, d, idx;
int p[N], c[N], k[N], match[N];
int e[M], ne[M], h[N];
int w[N], st[N];
stack<int> ans;
inline long long read() {
  char c = getchar();
  long long x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
void add(int a, int b) {
  e[idx] = b;
  ne[idx] = h[a];
  h[a] = idx++;
}
bool find(int x) {
  for (int i = h[x]; ~i; i = ne[i]) {
    int v = e[i];
    if (st[v]) continue;
    st[v] = 1;
    if (match[v] == -1 || find(match[v])) {
      match[v] = x;
      return true;
    }
  }
  return false;
}
int main() {
  memset(h, -1, sizeof h);
  ;
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) p[i] = read();
  for (int i = 1; i <= n; ++i) c[i] = read();
  d = read();
  for (int i = 1; i <= d; ++i) {
    k[i] = read();
    w[k[i]] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    if (!w[i]) add(p[i], c[i]);
  }
  memset(match, -1, sizeof match);
  ;
  int tot = 0;
  for (int i = d; i >= 1; --i) {
    memset(st, 0, sizeof st);
    ;
    while (find(tot)) {
      tot++;
      memset(st, 0, sizeof st);
      ;
    }
    ans.push(tot);
    add(p[k[i]], c[k[i]]);
  }
  while (!ans.empty()) {
    int x = ans.top();
    ans.pop();
    cout << x << '\n';
  }
}
