#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int arr[n + 5], res[n + 5];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  set<int> distinct;
  for (int i = n; i >= 1; i--) {
    distinct.insert(arr[i]);
    res[i] = distinct.size();
  }
  while (m--) {
    cin >> n;
    cout << res[n] << "\n";
  }
}
