#include #include #include int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int n, m; std::cin >> n >> m; std::map table; long long a; for (auto i = 0; i < n; i++) { std::cin >> a; table[a]++; } int b; for (auto j = 0; j < m; j++) { std::cin >> b; std::cout << table[b]; if (j < m - 1) { std::cout << ' '; } else { std::cout << std::endl; } } return EXIT_SUCCESS; }