#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k = 0, l, v[100005] = {0};
  bool ch[100005] = {0};
  cin >> n >> m;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = n; i; i--) {
    if (!ch[a[i]]) k++;
    ch[a[i]] = 1, v[i] = k;
  }
  while (m--) {
    cin >> l;
    cout << v[l] << endl;
  }
  return 0;
}
