#include using namespace std; struct h { size_t operator()(long k) const { __uint128_t n = k; return (n * n) >> 32; } }; int main() { int n, m; cin >> n >> m; unordered_map a; for (int i = 0; i < n; i++) { long a_i; cin >> a_i; a[a_i]++; } for (int i = 0; i < m; i++) { long b; cin >> b; cout << a[b]; if (i < m - 1) { cout << " "; } else { cout << endl; } } }