#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, q;
  cin >> n >> k;
  vector<long long> a(n + 1);
  vector<long long> b(n + 1);
  map<long long, int> mp;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long count = 0;
  for (auto i = n; i >= 1; i--) {
    if (mp[a[i]] != 1) {
      count += 1;
      mp[a[i]] = 1;
      b[i] = count;
    } else {
      b[i] = count;
    }
  }
  while (k--) {
    cin >> q;
    cout << b[q] << "\n";
  }
  return 0;
}
