#include <bits/stdc++.h>
int main() {
  int n, m, l;
  std::cin >> n >> m;
  std::vector<int> lookup(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> lookup[i];
  }
  std::unordered_set<int> m_set;
  m_set.insert(lookup[n - 1]);
  lookup[n - 1] = 1;
  for (int i = n - 2; i > -1; --i) {
    if (m_set.find(lookup[i]) == m_set.end()) {
      m_set.insert(lookup[i]);
      lookup[i] = lookup[i + 1] + 1;
    } else {
      lookup[i] = lookup[i + 1];
    }
  }
  for (int i = 0; i < m; ++i) {
    std::cin >> l;
    std::cout << lookup[l - 1] << std::endl;
  }
  return 0;
}
