#include using namespace std; size_t r; struct Hash { size_t operator()(const long long &x) const { return hash()(x) ^ r; } }; int main() { int n, m; cin >> n >> m; srand(time(NULL)); r = rand() << 16 + rand(); 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; }