#include <bits/stdc++.h>
using namespace std;
long long t, n, i, j, k;
long long dp[100005];
long long a[100005];
map<int, int> chk;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  t = 1;
  while (t--) {
    cin >> n >> k;
    for (i = 0; i < n; ++i) {
      cin >> a[i];
    }
    dp[n] = 1;
    chk[a[n - 1]] = 1;
    for (i = n - 2; i >= 0; --i) {
      if (!chk[a[i]]) {
        dp[i + 1] = 1 + dp[i + 2];
        chk[a[i]] = 1;
      } else
        dp[i + 1] = dp[i + 2];
    }
    for (i = 0; i < k; ++i) {
      int x;
      cin >> x;
      cout << dp[x] << "\n";
    }
  }
  return 0;
}
