#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 1;
int a[MAX_N];
int f[MAX_N];
int l[MAX_N];
int n, m;
set<int> num;
int main() {
  cin >> n >> m;
  for (int x = 1; x <= n; x++) cin >> a[x];
  for (int x = 1; x <= m; x++) cin >> l[x];
  f[n] = 1;
  num.insert(a[n]);
  for (int x = n - 1; x >= 1; x--) {
    f[x] = f[x + 1];
    if (!num.count(a[x])) {
      num.insert(a[x]);
      f[x]++;
    }
  }
  for (int x = 1; x <= m; x++) cout << f[l[x]] << endl;
  return 0;
}
