#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 100 + 121;
int a[maxn];
bool mark[maxn];
int ans[maxn];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = n; i > 0; i--) {
    ans[i] = ans[i + 1];
    if (!mark[a[i]]) {
      mark[a[i]] = 1;
      ans[i]++;
    }
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    cout << ans[x] << endl;
  }
}
