#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<int> a(n, 0);
  vector<int> dp(100001, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  int cnt = 0;
  vector<int> ti(n, 0);
  for (int i = n - 1; i >= 0; i--) {
    if (dp[a[i]] == 0) {
      cnt++;
      dp[a[i]] = 1;
    }
    ti[i] = cnt;
  }
  int t;
  for (int i = 0; i < m; i++) {
    cin >> t;
    cout << ti[t - 1] << endl;
  }
  return 0;
}
