#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1;
long long int a[maxn * 5], c[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  int dp[n];
  dp[n - 1] = 1;
  c[a[n - 1]] = 1;
  for (int i = n - 2; i >= 0; i--) {
    if (c[a[i]] == 1)
      dp[i] = dp[i + 1];
    else {
      dp[i] = dp[i + 1] + 1;
      c[a[i]] = 1;
    }
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    cout << dp[x - 1] << endl;
  }
  return 0;
}
