#include <bits/stdc++.h>
using namespace std;
int gcd(int xx, int yy) {
  while (yy != 0) {
    xx = xx % yy;
    swap(xx, yy);
  }
  return xx;
}
int lcm(int xx, int yy) { return (xx / gcd(xx, yy)) * yy; }
int a[100005], b[100005], c[100005], n, m, l[100005];
int main() {
  cin >> n >> m;
  for (int i = (1), _b = (n); i <= _b; i++) cin >> a[i];
  for (int i = (1), _b = (m); i <= _b; i++) cin >> l[i];
  for (int i = (1), _b = (100000); i <= _b; i++) {
    b[i] = 0;
    c[i] = 0;
  }
  c[n + 1] = 0;
  for (int i = (n), _b = (1); i >= _b; i--)
    if (b[a[i]] == 0) {
      c[i] = c[i + 1] + 1;
      b[a[i]] = 1;
    } else
      c[i] = c[i + 1];
  for (int i = (1), _b = (m); i <= _b; i++) cout << c[l[i]] << endl;
  return 0;
}
