#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l;
  cin >> n >> m;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  set<int> s;
  for (int i = n - 1; i >= 0; i--) {
    s.insert(a[i]);
    b[i] = s.size();
  }
  for (int i = 0; i < m; i++) {
    cin >> l;
    cout << b[l - 1] << "\n";
  }
  return 0;
}
