#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 7;
int dp[maxn];
bool mark[maxn];
int a[maxn];
int q[maxn];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < m; i++) scanf("%d", q + i);
  for (int i = n - 1; i >= 0; i--) {
    if (!mark[a[i]]) {
      dp[i] = dp[i + 1] + 1;
      mark[a[i]] = true;
    } else
      dp[i] = dp[i + 1];
  }
  for (int i = 0; i < m; i++) printf("%d\n", dp[q[i] - 1]);
}
