#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int inp;
  vector<long long int> v1;
  map<long long int, long long int> m1;
  for (long long int i = 0; i < n; i++) {
    cin >> inp;
    m1[inp]++;
    v1.push_back(inp);
  }
  vector<long long int> sizes;
  for (long long int i = 0; i < n; i++) {
    if (i == 0) {
      m1[v1[0]]--;
      sizes.push_back(m1.size());
      if (m1[v1[i]] == 0) {
        m1.erase(v1[i]);
      }
    } else {
      m1[v1[i]]--;
      sizes.push_back(m1.size());
      if (m1[v1[i]] == 0) {
        m1.erase(v1[i]);
      }
    }
  }
  long long int ques;
  for (long long int h = 0; h < m; h++) {
    cin >> ques;
    cout << sizes[ques - 1] << endl;
  }
}
