#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long N, M;
  cin >> N >> M;
  vector<long long> v(N);
  for (long long i = 0; i < N; i++) cin >> v[i];
  set<long long> st;
  vector<long long> ans(10000009, 0);
  for (long long i = v.size() - 1; i >= 0; i--) {
    st.insert(v[i]);
    ans[i] = st.size();
  }
  while (M--) {
    long long a;
    cin >> a;
    a--;
    cout << ans[a] << "\n";
  }
  return 0;
}
