#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  ;
  int a[100001] = {0};
  int n, m, l, i;
  cin >> n >> m;
  int ans[n + 1], b[n + 1];
  for (i = 1; i <= n; i++) cin >> b[i];
  ans[n] = 1;
  a[b[n]] = 1;
  for (i = n; i > 1; i--) {
    ans[i - 1] = ans[i] + (a[b[i - 1]] != 1);
    a[b[i - 1]] = 1;
  }
  for (i = 0; i < m; i++) {
    cin >> l;
    cout << ans[l] << '\n';
  }
}
