#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1073741824;
const long long int MX = 1e5 + 10, inf = 1e9 + 7;
int a[MX], track[MX];
int vis[MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  track[n + 1] = 0;
  for (int i = n; i >= 1; i--) {
    if (!vis[a[i]]) {
      track[i] = track[i + 1] + 1;
      vis[a[i]] = 1;
    } else
      track[i] = track[i + 1];
  }
  while (m--) {
    int q;
    cin >> q;
    cout << track[q] << '\n';
  }
  return 0;
}
