#include <bits/stdc++.h>
using namespace std;
void sc() {}
template <class T, class... A>
void sc(T& t, A&... a) {
  cin >> t, sc(a...);
}
void pr() {}
template <class T, class... A>
void pr(T t, A... a) {
  cout << t, pr(a...);
}
const int MM = 1e5 + 5;
int n, m, a[MM], psa[MM];
unordered_set<int> vis;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  sc(n, m);
  for (int i = 1; i <= n; i++) sc(a[i]);
  for (int i = n; i; i--) {
    if (vis.count(a[i])) continue;
    psa[i]++;
    vis.insert(a[i]);
  }
  for (int i = n; i; i--) psa[i] += psa[i + 1];
  while (m--) {
    int l;
    sc(l);
    pr(psa[l], '\n');
  }
  return 0;
}
