#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int arr[N];
int u[N];
set<int> s;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
  }
  for (int i = n - 1; i >= 0; --i) {
    s.insert(arr[i]);
    u[i] = s.size();
  }
  int t;
  for (int k = 0; k < m; ++k) {
    cin >> t;
    cout << u[t - 1] << endl;
  }
  return 0;
}
