#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[maxn], l[maxn];
struct Tnode {
  int le, ri;
  int sum;
} tree[maxn << 2];
void build(int l, int r, int k) {
  tree[k].le = l;
  tree[k].ri = r;
  tree[k].sum = 0;
  if (l == r)
    return;
  else {
    int mid = (l + r) >> 1;
    build(l, mid, k << 1);
    build(mid + 1, r, k << 1 | 1);
  }
}
void update(int pos, int k) {
  if (tree[k].le == tree[k].ri) {
    tree[k].sum = 1;
    return;
  }
  int mid = (tree[k].le + tree[k].ri) >> 1;
  if (pos <= mid)
    update(pos, k << 1);
  else
    update(pos, k << 1 | 1);
  tree[k].sum = tree[k << 1].sum + tree[k << 1 | 1].sum;
}
int query(int l, int r, int k) {
  if (tree[k].le == l && tree[k].ri == r) return tree[k].sum;
  int mid = (tree[k].le + tree[k].ri) >> 1;
  if (l > mid)
    return query(l, r, k << 1 | 1);
  else if (r <= mid)
    return query(l, r, k << 1);
  else
    return query(l, mid, k << 1) + query(mid + 1, r, k << 1 | 1);
}
int main() {
  int n, m, q;
  scanf("%d %d", &n, &m);
  build(1, 100000, 1);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = n; i >= 1; i--) {
    update(a[i], 1);
    l[i] = query(1, 100000, 1);
  }
  while (m--) {
    scanf("%d", &q);
    printf("%d\n", l[q]);
  }
  return 0;
}
