#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> a(n), ans(n, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  set<int> che;
  for (int i = n - 1; i > -1; i--) {
    che.insert(a[i]);
    ans[i] = che.size();
  }
  while (m--) {
    int val;
    cin >> val;
    cout << ans[val - 1] << "\n";
  }
}
