#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, value;
  cin >> n >> m;
  int arr[n];
  int tmp[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  set<int> s;
  for (int i = n - 1; i >= 0; i--) {
    s.insert(arr[i]);
    tmp[i] = s.size();
  }
  for (int i = 0; i < m; i++) {
    cin >> value;
    cout << tmp[value - 1] << endl;
  }
  return 0;
}
