#define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; int main(){ int N, M; cin >> N >> M; map mp; for(int i = 0; i < N; i++){ ll A; cin >> A; mp[A]++; } ll B; cin >> B; cout << mp[B]; for(int i = 1; i < M; i++){ cin >> B; cout << " " << mp[B]; } cout << endl; }