#include <bits/stdc++.h>
using namespace std;
const int maxi = 100001;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long int visited[maxi] = {0}, ans[maxi] = {0};
  for (long long int i = n - 1; i >= 0; i--) {
    if (!visited[arr[i]]) {
      ans[i] = ans[i + 1] + 1;
      visited[arr[i]] = 1;
    } else
      ans[i] = ans[i + 1];
  }
  while (m--) {
    long long int x;
    cin >> x;
    cout << ans[x - 1] << endl;
  }
  return 0;
}
