#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  long long a[n + 1];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  set<long long> s;
  long long dp[n];
  dp[n - 1] = 1;
  s.insert(a[n - 1]);
  for (long long i = n - 2; i >= 0; i--) {
    dp[i] = dp[i + 1] + (s.find(a[i]) == s.end());
    s.insert(a[i]);
  }
  while (m--) {
    long long x;
    cin >> x;
    cout << dp[x - 1] << "\n";
  }
}
