#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, Q;
  cin >> N >> Q;
  long long arr[N + 1];
  int i = 1;
  for (i = 1; i <= N; i++) cin >> arr[i];
  map<int, int> MP;
  long long S[N + 1];
  for (i = N; i >= 1; i--) {
    MP[arr[i]] = 1;
    S[i] = (int)MP.size();
  }
  while (Q--) {
    long long X;
    cin >> X;
    cout << S[X] << "\n";
  }
}
