#include <bits/stdc++.h>
using namespace std;
int* fun(int n, int* input) {
  int* answers = new int[n];
  unordered_map<int, int> values;
  answers[n - 1] = 1;
  values[input[n - 1]] = 1;
  for (int i = n - 2; i >= 0; i--) {
    answers[i] = answers[i + 1];
    if (values[input[i]] == 1) {
      continue;
    } else {
      answers[i]++;
      values[input[i]] = 1;
    }
  }
  return answers;
}
int main() {
  int n, m;
  cin >> n >> m;
  int* input = new int[n];
  for (int i = 0; i < n; i++) cin >> input[i];
  int* answers = fun(n, input);
  for (int i = 0; i < m; i++) {
    int curr;
    cin >> curr;
    cout << answers[curr - 1] << endl;
  }
  return 0;
}
