#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
map<int, int> mp;
int n, m, k;
int d[maxn];
int ans[maxn];
int cmp(int x, int y) { return x < y; }
void Init() { mp.clear(); }
void Input() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &d[i]);
}
void Solve() {
  ans[n] = 1;
  mp[d[n]] = 1;
  for (int i = n - 1; i > 0; --i) {
    if (mp[d[i]] == 0) {
      mp[d[i]] = 1;
      ans[i] = ans[i + 1] + 1;
    } else
      ans[i] = ans[i + 1];
  }
  while (m--) {
    int x;
    scanf("%d", &x);
    printf("%d\n", ans[x]);
  }
}
void Output() {}
int main() {
  Init();
  Input();
  Solve();
  Output();
  return 0;
}
