#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
long int dp[N], dp2[N];
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int a[n], total = 0;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long int i = n; i > 0; i--) {
    if (dp2[a[i]] == 0) {
      total++;
      dp2[a[i]]++;
    }
    dp[n - i + 1] = total;
  }
  for (long long int i = 0; i < m; i++) {
    long long int l;
    cin >> l;
    cout << dp[n - l + 1] << endl;
  }
  return 0;
}
