#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int main() { int N, M; cin >> N >> M; vector A(N); vector B(N); unordered_map mp; for (int i = 0; i < N; ++i) { cin >> A[i]; mp[A[i]]++; } for (int i = 0; i < M; ++i) { cin >> B[i]; } for (int i = 0; i < M; ++i) { cout << mp[B[i]]; if (i != M - 1) cout << " "; } cout << endl; return 0; }