#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, p[1000000];
  set<int> s;
  map<int, int> mp;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    s.insert(p[i]);
    mp[i] = s.size();
  }
  while (m--) {
    int a;
    cin >> a;
    a--;
    cout << mp[a] << endl;
  }
  return 0;
}
