#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> dp(n + 1, 0), dp2(n, 0);
  set<int> dp1;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> dp2[i];
  }
  for (int j = n - 1; j >= 0; j--) {
    int x = dp2[j];
    int a;
    if (dp1.find(x) == dp1.end()) {
      dp1.insert(x);
      a = 1;
    } else {
      a = 0;
    }
    dp[j] += dp[j + 1] + a;
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    x -= 1;
    cout << dp[x] << endl;
  }
}
