#include using namespace std; struct h { size_t operator()(long n) const { return n; } }; 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; } } }