#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n), r(n + 1, 0);
  vector<bool> vis(100000 + 7, false);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = n - 1; i >= 0; i--) {
    if (vis[v[i]] == false) {
      vis[v[i]] = true;
      r[i] = r[i + 1] + 1;
    } else
      r[i] = r[i + 1];
  }
  for (int i = 0; i < m; i++) {
    int l;
    cin >> l;
    cout << r[l - 1] << '\n';
  }
  return 0;
}
