#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i;
  cin >> n >> m;
  vector<int> arr(n, 0);
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<int> vis(100003, 0);
  int count = 0;
  vector<int> result(n, 0);
  for (i = n - 1; i >= 0; i--) {
    if (vis[arr[i]] == 0) {
      count++;
      vis[arr[i]] = 1;
      result[i] = count;
    } else {
      result[i] = count;
    }
  }
  int x;
  while (m--) {
    cin >> x;
    cout << result[x - 1] << endl;
  }
  return 0;
}
