#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 6;
int n, m, d, a[N], b[N], c[N], ans[N], v[N], w[N], f[N];
vector<int> e[N];
bool dfs(int x) {
  for (auto &y : e[x]) {
    if (v[y]) continue;
    v[y] = 1;
    if (!~f[y] || dfs(f[y])) {
      f[y] = x;
      return 1;
    }
  }
  return 0;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  cin >> d;
  for (int i = 1; i <= d; i++) scanf("%d", &c[i]);
  for (int i = 1; i <= d; i++) w[c[i]] = 1;
  for (int i = 1; i <= n; i++)
    if (!w[i]) {
      if (a[i] > m) continue;
      e[a[i]].push_back(b[i] + m);
      e[b[i] + m].push_back(a[i]);
    }
  memset(f, -1, sizeof(f));
  for (int i = d; i; i--) {
    for (int j = ans[i + 1]; j <= m; j++) {
      memset(v, 0, sizeof(v));
      if (!dfs(j)) {
        ans[i] = j;
        break;
      }
    }
    if (a[c[i]] > m) continue;
    e[a[c[i]]].push_back(b[c[i]] + m);
    e[b[c[i]] + m].push_back(a[c[i]]);
  }
  for (int i = 1; i <= d; i++) printf("%d\n", ans[i]);
  return 0;
}
