#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m, a[100010], d[100010] = {0}, x, i, j;
  bool dd[100010] = {false};
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = n; i > 0; i--) {
    d[i] = d[i + 1] + ((dd[a[i]]) ? 0 : 1);
    dd[a[i]] = true;
  }
  for (i = 0; i < m; i++) {
    cin >> x;
    cout << d[x] << endl;
  }
}
