#include <bits/stdc++.h>
using namespace std;
int a, s, d[100002], f, g[100002], h[100002], j, k, l, i, n, m;
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> d[i];
    if (g[d[i]] == 0) k++;
    g[d[i]]++;
  }
  for (i = 0; i < n; i++) {
    h[i] = k;
    g[d[i]]--;
    if (g[d[i]] == 0) k--;
  }
  for (i = 0; i < m; i++) {
    cin >> f;
    cout << h[f - 1] << endl;
  }
}
