#include <bits/stdc++.h>
using namespace std;
inline int BITS(long long __a) {
  short int __c = 0;
  __a <<= 1;
  while (__a) __c += ((__a >>= 1) & 1);
  return __c;
}
inline bool prime(int n) {
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}
set<int> s;
int N, M, V[100010], A[100010];
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> V[i];
  s.insert(V[N - 1]);
  A[N - 1] = 1;
  for (int i = N - 2; i >= 0; i--) {
    s.insert(V[i]);
    A[i] = ((int)s.size());
  }
  for (int i = 0; i < M; i++) {
    int j;
    cin >> j;
    cout << A[j - 1] << endl;
  }
  return 0;
}
