#include <bits/stdc++.h>
using namespace std;
int n, m, e;
vector<int> line[6000];
bool used[6000];
int f[6000];
bool find(int u) {
  for (auto v : line[u]) {
    if (!used[v]) {
      used[v] = true;
      if (f[v] == -1 || find(f[v])) {
        f[v] = u;
        return true;
      }
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  m = M;
  n = 5000;
  vector<int> P(N + 1), C(N + 1);
  for (int i = 1; i <= N; i++) cin >> P[i];
  for (int i = 1; i <= N; i++) cin >> C[i];
  int d;
  cin >> d;
  vector<int> D(d);
  set<int> se;
  for (int i = 0; i < d; i++) {
    cin >> D[i];
    se.insert(D[i]);
  }
  for (int i = 1; i <= N; i++)
    if (se.find(i) == se.end()) line[P[i]].push_back(C[i]);
  int ans = 0;
  vector<int> otp;
  memset(f, -1, sizeof(f));
  bool judge = true;
  for (auto rite = D.rbegin(); rite != D.rend(); rite++) {
    while (judge) {
      memset(used, 0, sizeof(used));
      if (find(ans))
        ans++;
      else {
        judge = false;
        break;
      }
    }
    otp.push_back(ans);
    if (P[*rite] <= ans) judge = true;
    line[P[*rite]].push_back(C[*rite]);
  }
  for (auto rite = otp.rbegin(); rite != otp.rend(); rite++)
    cout << *rite << "\n";
}
