#include <bits/stdc++.h>
using namespace std;
long long int b[1000000] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n, m, a[100000], l, x, count = 0;
  cin >> n >> m;
  for (long long int i = 0; i < n; ++i) {
    cin >> a[i];
    if (b[a[i]] == 0) ++count;
    ++b[a[i]];
  }
  for (long long int i = 0; i < n; ++i) {
    if (b[a[i]] != 1) {
      b[a[i]] -= 1;
      a[i] = count;
    } else {
      a[i] = count;
      --count;
    }
  }
  while (m--) {
    cin >> x;
    cout << a[x - 1] << "\n";
  }
  return 0;
}
