#include <bits/stdc++.h>
using namespace std;
void yasser_gomma() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long arr[1000000], na[1000000];
int freq[1000000];
int main() {
  int n, m, c = 0;
  cin >> n >> m;
  arr[0] = -1;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = n; i >= 1; i--) {
    if (freq[arr[i]] == 0) {
      c++;
      freq[arr[i]]++;
      na[i] = c;
    } else {
      na[i] = c;
    }
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    cout << na[x] << endl;
  }
}
