#include <bits/stdc++.h>
using namespace std;
bool booll[100000];
int main() {
  int n, m;
  cin >> n >> m;
  int a[n], b[m], dp[n];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) cin >> b[i];
  dp[n] = 1;
  booll[a[n]] = true;
  for (int i = n - 1; i >= 1; i--) {
    if (booll[a[i]] == 1)
      dp[i] = dp[i + 1];
    else
      dp[i] = dp[i + 1] + 1;
    booll[a[i]] = true;
  }
  for (int i = 1; i <= m; i++) cout << dp[b[i]] << endl;
}
