#include <bits/stdc++.h>
int main() {
  int n, m, a;
  std::cin >> n >> m;
  std::map<int, int> last_pos;
  for (int i = 0; i < n; i++) {
    std::cin >> a;
    last_pos[a] = i;
  }
  std::vector<int> sums(n, 0);
  for (const auto& i : last_pos) {
    sums[i.second]++;
  }
  int last_sum = last_pos.size();
  for (int& i : sums) {
    int new_sum = last_sum - i;
    i = last_sum;
    last_sum = new_sum;
  }
  for (int i = 0; i < m; i++) {
    std::cin >> a;
    std::cout << sums[a - 1] << std::endl;
  }
}
