#include #include #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) using ll = long long; using namespace std; int main() { int n, m; cin >> n >> m; unordered_map f; repeat (i,n) { ll a; cin >> a; f[a] += 1; } repeat (j,m) { ll b; cin >> b; int c = f.count(b) ? f[b] : 0; cout << c << ' '; } cout << endl; return 0; }