#include <bits/stdc++.h>
using namespace std;
set<int> st;
int arr[1000005], dp[1000005];
int main() {
  int n, m, l;
  (scanf("%d%d", &n, &m));
  for (int i = 1; i <= n; i++) {
    (scanf("%d", &arr[i]));
  }
  dp[n] = 1;
  st.insert(arr[n]);
  for (int i = n - 1; i >= 1; i--) {
    if (st.find(arr[i]) == st.end()) {
      st.insert(arr[i]);
      dp[i] = 1 + dp[i + 1];
    } else
      dp[i] = dp[i + 1];
  }
  while (m--) {
    (scanf("%d", &l));
    cout << dp[l] << "\n";
  }
}
