#include <bits/stdc++.h>
using namespace std;
int c[100001];
int d[100001];
int main() {
  int n;
  cin >> n;
  int m;
  cin >> m;
  int i;
  int t = 0;
  int a[n];
  for (i = 0; i <= n - 1; i++) {
    cin >> a[i];
    c[a[i]]++;
    if (c[a[i]] == 1) t++;
  }
  for (i = 0; i <= n - 1; i++) {
    d[i] = t;
    c[a[i]]--;
    if (!c[a[i]]) t--;
  }
  int s;
  for (i = 0; i <= m - 1; i++) {
    cin >> s;
    cout << d[s - 1] << endl;
  }
}
