#include <bits/stdc++.h>
using namespace std;
int a[100004], ans[100004];
int n, m, t;
int main() {
  set<int> st;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = n; i >= 1; i--) {
    st.insert(a[i]);
    ans[i] = st.size();
  }
  while (m--) {
    scanf("%d", &t);
    printf("%d\n", ans[t]);
  }
}
