#include <bits/stdc++.h>
using namespace std;
int cnt[100002] = {0};
int main() {
  ios::sync_with_stdio(false);
  int n, m, i, j, k;
  cin >> n >> m;
  int x[n + 1];
  int distinct[n + 1];
  for (i = 0; i < n; i++) {
    cin >> x[i];
    distinct[i] = 0;
  }
  distinct[n] = 0;
  for (i = n - 1; i >= 0; i--) {
    if (cnt[x[i]] == 0) {
      cnt[x[i]] = 1;
      distinct[i] = distinct[i + 1] + 1;
    } else {
      distinct[i] = distinct[i + 1];
    }
  }
  while (m--) {
    cin >> k;
    cout << distinct[k - 1] << "\n";
  }
  return 0;
}
