#include #include #include using namespace std; const int Bsizes[]={3,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,81}; const int xor_nums[]={0x100007d1,0x5ff049c9,0x14560859,0x07087fef,0x3e277d49,0x4dba1f17,0x709c5988,0x05904258,0x1aa71872,0x238819b3,0x7b002bb7,0x1cf91302,0x0012290a,0x1083576b,0x76473e49,0x3d86295b,0x20536814,0x08634f4d,0x115405e8,0x0e6359f2}; template class myhash_set:public std::unordered_set { private: int x; public: inline T getorigin(T key){return key^x;}; void insert(T key){std::unordered_set::insert(key^x);} int count(T key){return std::unordered_set::count(key^x);} myhash_set():std::unordered_set(),x(xor_nums[rand()%20]){std::unordered_set::rehash(Bsizes[rand()%20]);} }; template class myhash_map:public std::unordered_map { private: int x; public: inline T getorigin(T key){return key^x;}; U& operator[](T key){return std::unordered_map::operator[](key^x);} int count(T key){return std::unordered_map::count(key^x);} myhash_map():std::unordered_map(),x(xor_nums[rand()%20]){std::unordered_map::rehash(Bsizes[rand()%20]);} }; int main() { int n, m; myhash_map cnt; cin >> n >> m; while (n--) { long long a; cin >> a; cnt[a]++; } while (m--) { long long b; cin >> b; cout << cnt[b] << " \n"[!m]; } return 0; }