#include <bits/stdc++.h>
using namespace std;
long long int binpow(long long x, long long p) {
  if (p == 0) {
    return 1;
  } else if (p == 1)
    return x;
  else {
    if (p % 2 == 0)
      return binpow(x * x, p / 2);
    else
      return x * binpow(x * x, p / 2);
  }
}
int gcd(int a, int b) {
  if (!a || !b) return a | b;
  unsigned shift = __builtin_ctz(a | b);
  a >>= __builtin_ctz(a);
  do {
    b >>= __builtin_ctz(b);
    if (a > b) swap(a, b);
    b -= a;
  } while (b);
  return a << shift;
}
int main() {
  long long n, m;
  cin >> n >> m;
  long long arr[n];
  set<int> s;
  map<long long, long long> mp;
  for (long long(i) = (0); (i) < (1e5 + 5); (i)++) {
    mp[i] = 0;
  }
  for (long long(i) = (0); (i) < (n); (i)++) {
    cin >> arr[i];
    s.insert(arr[i]);
    mp[arr[i]]++;
  }
  long long i = 1;
  long long ans[n];
  ans[0] = s.size();
  mp[arr[0]]--;
  long long cnt = s.size();
  if (mp[arr[0]] == 0) {
    cnt -= 1;
  }
  for (long long(i) = (1); (i) < (n); (i)++) {
    if (mp[arr[i]] < 1) {
      cnt -= 1;
      ans[i] = cnt;
    } else {
      mp[arr[i]] -= 1;
      ans[i] = cnt;
      if (mp[arr[i]] == 0) cnt -= 1;
    }
  }
  for (long long(i) = (0); (i) < (m); (i)++) {
    long long k;
    cin >> k;
    cout << ans[k - 1] << "\n";
  }
  return 0;
}
