#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
vector<bool> used;
vector<vector<int>> gr;
vector<int> mt;
bool try_kuhn(int v) {
  if (used[v]) return 0;
  used[v] = 1;
  for (int u : gr[v]) {
    if (mt[u] == -1 || try_kuhn(mt[u])) {
      mt[u] = v;
      return 1;
    }
  }
  return 0;
}
const int MAX_P = 5e3;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; i++) cin >> a[i].first;
  for (int i = 0; i < n; i++) cin >> a[i].second, a[i].second--;
  int q;
  cin >> q;
  vector<bool> is_deleted(n);
  vector<int> b(q);
  for (int i = 0; i < q; i++) cin >> b[i], b[i]--, is_deleted[b[i]] = 1;
  gr.resize(MAX_P);
  for (int i = 0; i < n; i++)
    if (!is_deleted[i]) gr[a[i].first].push_back(a[i].second);
  mt.resize(m, -1);
  vector<int> ans;
  int i = 0;
  while (!b.empty()) {
    while (true) {
      used = vector<bool>(MAX_P);
      if (try_kuhn(i))
        i++;
      else
        break;
    }
    ans.push_back(i);
    gr[a[b.back()].first].push_back(a[b.back()].second);
    b.pop_back();
  }
  reverse((ans).begin(), (ans).end());
  for (int j : ans) cout << j << "\n";
  return 0;
}
