#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  cin >> n >> m;
  vector<int> v(n);
  for (int& i : v) cin >> i;
  unordered_set<int> ust;
  ust.insert(v.back());
  v.back() = 1;
  for (int i = n - 2; i > -1; --i) {
    ust.insert(v[i]);
    v[i] = ust.size();
  }
  while (m--) {
    cin >> n;
    cout << v[n - 1] << '\n';
  }
  return 0;
}
