#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(12);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<bool> seen(100001);
  vector<int> uniq(n);
  int k = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (!seen[a[i]]) {
      k++;
      seen[a[i]] = true;
    }
    uniq[i] = k;
  }
  for (int i = 0; i < m; i++) {
    int l;
    cin >> l;
    cout << uniq[l - 1] << endl;
  }
}
