#include using namespace std; unsigned xor_shift(unsigned x) { static unsigned y = time(NULL); x ^= y; x ^= x << 13; x ^= x >> 7; x ^= x << 17; return x; } struct Hash { size_t operator()(const long long &x) const { return xor_shift(hash()(x)); } }; int main() { int n, m; cin >> n >> m; unordered_map mp; for (int i = 0; i < n; i++) { long long a; scanf("%lld", &a); mp[a]++; } for (int i = 0; i < m; i++) { long long b; scanf("%lld", &b); printf("%d ", mp[b]); } cout << endl; }