#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAX = 100002;
const double EPS = 1e-7;
const double PI = acos(-1.0);
const int MOD = 1000000007;
using ull = unsigned long long;
using ll = long long;
bool b[100001];
int d[100002], a[100001];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = n; i >= 1; --i) {
    d[i] = d[i + 1] + !b[a[i]];
    b[a[i]] = true;
  }
  while (m--) {
    int l;
    cin >> l;
    cout << d[l] << '\n';
  }
}
