#include <bits/stdc++.h>
using namespace std;
set<int> s1;
int m, n, d[100100], i, sum, x[100100], a[100100];
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = n; i > 0; i--) {
    if (s1.find(a[i]) == s1.end()) {
      s1.insert(a[i]);
      d[i] = s1.size();
    } else
      d[i] = s1.size();
  }
  for (i = 0; i < m; i++) cin >> x[i];
  for (i = 0; i < m; i++) cout << d[x[i]] << endl;
  return 0;
}
