#include <bits/stdc++.h>
using namespace std;
int main() {
  long int c, ans, n, m;
  cin >> n >> m;
  long int i, a[n + 5], s[n + 5], b[100005];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = 0;
  }
  s[n - 1] = 1;
  c = a[n - 1];
  b[c] = 1;
  for (i = n - 2; i >= 0; i--) {
    c = a[i];
    if (b[c] == 1) {
      s[i] = s[i + 1];
    } else {
      b[c] = 1;
      s[i] = s[i + 1] + 1;
    }
  }
  for (i = 0; i < m; i++) {
    cin >> c;
    cout << s[c - 1] << endl;
  }
}
