#include #include #include using namespace std; using ll = long long; 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] += 1; } while (M--) { ll B; cin >> B; printf("%d%c", cnt[B], " \n"[M == 0]); } return 0; }