#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n >> q;
  long long a[n + 1];
  long long cnt[100005], ans[100005];
  ans[0] = 0;
  memset(cnt, 0, sizeof cnt);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = n; i > 0; i--) {
    if (cnt[a[i]] == 0)
      ans[i] = (i == n) ? 1 : ans[i + 1] + 1;
    else
      ans[i] = ans[i + 1];
    cnt[a[i]]++;
  }
  while (q--) {
    long long x;
    cin >> x;
    cout << ans[x] << endl;
  }
}
