#include <bits/stdc++.h>
int n, m;
int A[100005], B[100005], pass[100005];
int l;
int main() {
  while (scanf("%d %d", &n, &m) != EOF) {
    int i, j;
    for (i = 1; i <= n; ++i) scanf("%d", &A[i]);
    int sum = 0;
    memset(B, 0, sizeof B);
    for (i = n; i >= 1; --i) {
      if (B[A[i]] == 0) {
        ++sum;
        B[A[i]] = 1;
      }
      pass[i] = sum;
    }
    for (j = 1; j <= m; ++j) {
      scanf("%d", &l);
      printf("%d\n", pass[l]);
    }
  }
  return 0;
}
