#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> arr(n);
  for (auto &a : arr) cin >> a;
  vector<long long> res(n);
  set<long long> s;
  for (int i = n - 1; i >= 0; i--) {
    s.insert(arr[i]);
    res[i] = s.size();
  }
  while (m--) {
    long long tem;
    cin >> tem;
    tem--;
    cout << res[tem] << endl;
  }
  return 0;
}
