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