#include <bits/stdc++.h>
using namespace std;
int dx[] = {-2, -2, 2, 2};
int dy[] = {2, -2, -2, 2};
long long toInt(string s) {
  stringstream aa(s);
  long long k;
  aa >> k;
  return k;
}
string toString(long long t) {
  stringstream y;
  y << t;
  return y.str();
}
int gcd(int a, int b) {
  if (!b)
    return a;
  else
    return gcd(b, a % b);
}
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
long long m, k, n, d, sum;
long long a[111111], diff[111111], ll[111111];
map<int, bool> MAP;
int main(void) {
  cin >> n >> m;
  for (int i = (0); i < (n); i++) cin >> a[i];
  diff[n - 1] = 1;
  MAP[a[n - 1]] = true;
  for (int i = n - 2; i >= 0; i--) {
    if (!MAP[a[i]]) {
      MAP[a[i]] = true;
      diff[i] = diff[i + 1] + 1;
    } else
      diff[i] = diff[i + 1];
  }
  vector<int> ans;
  for (int i = (0); i < (m); i++) {
    cin >> d;
    ans.push_back(diff[d - 1]);
  }
  for (int i = (0); i < (m); i++) cout << ans[i] << endl;
  return 0;
}
