#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], f[100005], b[100005];
bool bin[100005];
void inp() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
}
void work() {
  for (int i = n; i; --i) {
    if (bin[a[i]])
      f[i] = f[i + 1];
    else
      f[i] = f[i + 1] + 1;
    bin[a[i]] = 1;
  }
}
void print() {
  for (int i = 1; i <= m; ++i) cout << f[b[i]] << endl;
}
int main() {
  inp();
  work();
  print();
}
