#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int dx2[] = {1, -1, 0, 0, -1, 1, -1, 1};
int dy2[] = {0, 0, 1, -1, 1, -1, -1, 1};
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
int ans[100005];
int a[100005];
int used[1000001];
int main() {
  int n = read();
  int m = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = n; i >= 1; i--) {
    if (used[a[i]])
      ans[i] = ans[i + 1];
    else
      ans[i] = ans[i + 1] + 1, used[a[i]] = 1;
  }
  while (m--) {
    printf("%d\n", ans[read()]);
  }
  return 0;
}
