#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, m, l, i, integer;
  array<long int, 100000> array_of_integers;
  array<long int, 100000> array_of_elements;
  map<long int, long int> map_of_integers;
  pair<map<long int, long int>::iterator, bool> isnew;
  while (cin >> n >> m) {
    for (i = 0; i < n; i++) {
      cin >> integer;
      array_of_integers[i] = integer;
      isnew = map_of_integers.insert(pair<long int, long int>(integer, 1));
      if (!isnew.second) map_of_integers[integer]++;
    }
    for (i = 0; i < n; i++) {
      array_of_elements[i] = (long int)map_of_integers.size();
      if (--map_of_integers[array_of_integers[i]] == 0) {
        map_of_integers.erase(array_of_integers[i]);
      }
    }
    for (n = 0; n < m; n++) {
      cin >> l;
      cout << array_of_elements[l - 1] << endl;
    }
    break;
  }
  return 0;
}
