#include #include #include using namespace std; using ll = long long; const ll mask = random_device{}(); int main() { ios::sync_with_stdio(false), cin.tie(0); int N, M; cin >> N >> M; __gnu_pbds::gp_hash_table cnt; for (int i = 0; i < N; i++) { ll A; cin >> A; cnt[A ^ mask] += 1; } while (M--) { ll B; cin >> B; printf("%d%c", cnt[B ^ mask], " \n"[M == 0]); } return 0; }