#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int n, m;
int a[N], used[N], dp[N];
vector<int> ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = n; i >= 1; --i) {
    if (!used[a[i]])
      dp[i] = dp[i + 1] + 1;
    else
      dp[i] = dp[i + 1];
    used[a[i]] = true;
  }
  for (int i = 1; i <= m; ++i) {
    int x;
    cin >> x;
    ans.push_back(dp[x]);
  }
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i] << endl;
  }
}
