#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s, p, k, t, m, x, y, l, ans;
  set<long long> S;
  cin >> n >> k;
  long long a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = n; i >= 1; i--) {
    S.insert(a[i]);
    a[i] = S.size();
  }
  while (k--) {
    cin >> x;
    cout << a[x] << endl;
  }
  return 0;
}
