#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int m, n, a[maxn], l[maxn];
int last[maxn], t[maxn];
void work(int x) {
  int l, r, mid, ans;
  l = 1, r = last[0];
  ans = last[0] + 1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (last[mid] >= x) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  printf("%d\n", last[0] - ans + 1);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    t[a[i]] = i;
  }
  last[0] = 0;
  for (int i = 1; i <= 1e5; i++)
    if (t[i] != 0) {
      last[++last[0]] = t[i];
    }
  sort(last + 1, last + 1 + last[0]);
  while (m--) {
    int x;
    scanf("%d", &x);
    work(x);
  }
}
