#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n + 5], ans[n + 5];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  set<int> rep;
  for (int i = n; i > 0; i--) {
    rep.insert(arr[i]);
    ans[i] = rep.size();
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    cout << ans[x] << endl;
  }
  return 0;
}
