#include <bits/stdc++.h>
using namespace std;
int count(long long a) {
  int cnt = 0;
  while (a != 0) {
    a /= 10;
    cnt++;
  }
  return cnt;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int arr[n + 1];
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  int fr[100002] = {0};
  for (int i = 1; i < n + 1; i++) fr[arr[i]]++;
  int cnt = 0;
  for (int i = 1; i < 100002; i++)
    if (fr[i] >= 1) cnt++;
  int dp[n + 1];
  dp[1] = cnt;
  for (int i = 2; i <= n; i++) {
    fr[arr[i - 1]]--;
    if (fr[arr[i - 1]] >= 1)
      dp[i] = dp[i - 1];
    else
      dp[i] = dp[i - 1] - 1;
  }
  while (m--) {
    int m1;
    cin >> m1;
    cout << dp[m1] << "\n";
  }
}
