#include <bits/stdc++.h>
using namespace std;
long long n, m, a[100007], p[100007];
bitset<100007> vis;
void solve() {
  cin >> n >> m;
  for (long long i = 1; i <= (n); ++i) cin >> a[i];
  for (long long i = n; i >= 1; --i) {
    p[i] = p[i + 1];
    if (!vis[a[i]]) ++p[i];
    vis[a[i]] = 1;
  }
  long long l;
  for (long long q = 0; q < (m); ++q) {
    cin >> l;
    cout << p[l];
    cout << '\n';
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  solve();
  return 0;
}
