#include "bits/stdc++.h" using namespace std; typedef long long ll; void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;}; int main(){ ll N, M; cin >> N >> M; mapX; for(ll i = 0; i < N; i++){ ll A; cin >> A; X[A]++; } vectorans; for(ll i = 0; i < M; i++){ ll B; cin >> B; ans.push_back(X[B]); } for(ll i = 0; i < ans.size(); i++){ cout << ans[i]; if(i + 1 == ans.size())cout << endl; else cout << " "; } return 0; }