#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, m = 0, x = 0, dist = 0;
  cin >> n >> m;
  map<int, int> cache;
  vector<int> last;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (cache.find(x) == cache.end()) {
      cache.insert(pair<int, int>(x, i));
    } else {
      cache[x] = i;
    }
  }
  for (map<int, int>::iterator it = cache.begin(); it != cache.end(); it++) {
    last.push_back(it->second);
  }
  if (last.size() == n) {
    for (int i = 0; i < m; i++) {
      cin >> x;
      cout << n - x + 1 << endl;
    }
  } else {
    sort(last.begin(), last.end());
    for (int i = 0; i < m; i++) {
      cin >> x;
      for (int j = 0; j < last.size(); j++) {
        if (last.at(j) >= x) {
          cout << last.size() - j << endl;
          break;
        }
      }
    }
  }
}
