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