#include <bits/stdc++.h>
using namespace std;
int a[100100], ans[100100], t[100100] = {};
bool w[100100] = {};
int main() {
  int m, n;
  cin >> m >> n;
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    if (w[a[i]] == false) {
      cnt++;
      w[a[i]] = true;
    }
    t[a[i]]++;
  }
  ans[1] = cnt;
  int q;
  t[a[0]]--;
  for (int i = 1; i < m; i++) {
    if (t[a[i - 1]] > 0)
      ans[i + 1] = ans[i];
    else
      ans[i + 1] = ans[i] - 1;
    t[a[i]]--;
  }
  for (int i = 0; i < n; i++) {
    cin >> q;
    cout << ans[q] << endl;
  }
  return 0;
}
