#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int A[n], B[n];
  set<int> S;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    S.insert(A[i]);
    B[i] = (int)S.size();
  }
  int l;
  for (int i = 0; i < m; i++) {
    cin >> l;
    cout << B[l - 1] << endl;
  }
  return 0;
}
