#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, m, ma = 0, l;
  cin >> n >> m;
  int ara[n + 1], distinct[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> ara[i];
    ma = max(ma, ara[i]);
    distinct[i] = 0;
  }
  distinct[n] = 1;
  bool is[ma + 1];
  for (i = 0; i <= ma; i++) is[i] = false;
  is[ara[n]] = 1;
  for (i = n - 1; i >= 1; i--) {
    distinct[i] = distinct[i + 1];
    if (!is[ara[i]]) {
      is[ara[i]] = true;
      distinct[i]++;
    }
  }
  for (i = 1; i <= m; i++) {
    cin >> l;
    cout << distinct[l] << endl;
    ;
  }
  return 0;
}
