#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  int z[100000] = {0}, x[n], y[m], a[n];
  int i;
  for (i = 0; i < n; i++) {
    cin >> x[i];
    if (z[x[i] - 1] == 0) {
      ans++;
    }
    z[x[i] - 1]++;
  }
  for (i = 0; i < n; i++) {
    z[x[i] - 1]--;
    if (z[x[i] - 1] == 0) {
      a[i] = ans;
      ans--;
    } else
      a[i] = ans;
  }
  for (i = 0; i < m; i++) {
    cin >> y[i];
    cout << a[y[i] - 1] << endl;
  }
}
