#include <bits/stdc++.h>
const unsigned int M = 1000000007;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, t, k, cnt = 0;
  cin >> n >> t;
  int a[n + 1], hash[100001] = {0};
  map<int, int> mp;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = n; i >= 1; i--) {
    if (mp[a[i]] > 0) {
      hash[i] = cnt;
      mp[a[i]]++;
    } else
      hash[i] = ++cnt, mp[a[i]]++;
    ;
  }
  while (t--) {
    cin >> k;
    cout << hash[k] << endl;
  }
}
