#include <bits/stdc++.h>
using namespace std;
int pot[5010], club[5010];
int n, m;
int src, des;
vector<int> adjl[10010];
bool vis_ri[10010];
int left_of[10010];
int mx_pot;
bool bpm(int le) {
  for (int i = 0; i <= (int)adjl[le].size() - 1; i++) {
    int ri = adjl[le][i];
    if ((vis_ri[ri] == 0) && (left_of[ri] == -1)) {
      left_of[ri] = le;
      return true;
    }
  }
  for (int i = 0; i <= (int)adjl[le].size() - 1; i++) {
    int ri = adjl[le][i];
    if (vis_ri[ri] == 0) {
      vis_ri[ri] = 1;
      if (bpm(left_of[ri])) {
        left_of[ri] = le;
        return true;
      }
    }
  }
  return false;
}
int shuru = 0;
int maxbpm() {
  for (int i = shuru; i <= mx_pot; i++) {
    shuru = i;
    memset((vis_ri), 0, sizeof(vis_ri));
    if (bpm(i)) {
    } else {
      return i;
    }
  }
  shuru = mx_pot + 1;
  return mx_pot + 1;
}
int club_idx(int idx) { return idx + mx_pot; }
void clear_edges(int idx) {
  for (int i = 0; i <= idx; i++) {
    adjl[i].clear();
  }
}
void add_edge(int u, int v) { adjl[u].push_back(v); }
int day_ara[5010];
int take[5010];
int main() {
  cin >> n >> m;
  mx_pot = 0;
  for (int i = 1; i <= n; i++) {
    cin >> pot[i];
    mx_pot = max(mx_pot, pot[i]);
  }
  for (int i = 1; i <= n; i++) {
    cin >> club[i];
  }
  int day;
  cin >> day;
  for (int i = 1; i <= day; i++) {
    cin >> day_ara[i];
    take[day_ara[i]] = 1;
  }
  for (int i = 1; i <= n; i++) {
    if (take[i] == 0) {
      add_edge(pot[i], club_idx(club[i]));
    }
  }
  memset((left_of), -1, sizeof(left_of));
  vector<int> ans;
  for (int i = day; i >= 1; i--) {
    ans.push_back(maxbpm());
    int idx = day_ara[i];
    add_edge(pot[idx], club_idx(club[idx]));
  }
  for (int i = (int)ans.size() - 1; i >= 0; i--) {
    cout << ans[i] << "\n";
  }
  return 0;
}
