#include <bits/stdc++.h>
using namespace std;
void in(long long int &number) {
  bool negative = false;
  register int c;
  number = 0;
  c = getchar();
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;
  if (negative) number *= -1;
}
void in(int &number) {
  bool negative = false;
  register int c;
  number = 0;
  c = getchar();
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;
  if (negative) number *= -1;
}
int k[100005];
int main() {
  int n, m;
  in(n);
  in(m);
  memset(k, 0, sizeof(k));
  vector<long long int> a(n);
  for (int i = 0; i <= n - 1; i++) in(a[i]);
  vector<int> dp(n);
  dp[n - 1] = 1;
  k[a[n - 1]] = 1;
  for (int i = n - 2; i >= 0; i--) {
    if (k[a[i]] == 0) {
      dp[i] = dp[i + 1] + 1;
      k[a[i]] = 1;
    } else
      dp[i] = dp[i + 1];
  }
  while (m--) {
    int l;
    in(l);
    l--;
    cout << dp[l] << "\n";
  }
  return 0;
}
