#include <bits/stdc++.h>
using namespace std;
int a[101000], b[100010], ans[100010], hashi[100010];
int main() {
  int n, m;
  while (cin >> n >> m) {
    memset(hashi, 0, sizeof(hashi));
    int cnt = 0;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = n; i >= 1; i--) {
      if (!hashi[a[i]]) cnt++;
      hashi[a[i]] = 1;
      ans[i] = cnt;
    }
    for (int i = 1; i <= m; i++) cin >> b[i];
    for (int i = 1; i <= m; i++) cout << ans[b[i]] << endl;
  }
}
