/** * */ // #include {{{ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef DEBUG #include #include #endif using namespace std; // }}} // type {{{ using s8 = int8_t; using u8 = uint8_t; using s16 = int16_t; using u16 = uint16_t; using s32 = int32_t; using u32 = uint32_t; using s64 = int64_t; using u64 = uint64_t; template using max_heap = priority_queue, less>; template using min_heap = priority_queue, greater>; // }}} // 適宜調整 //#define int s64 constexpr bool IOS_SYNCSTDIO = false; constexpr int IOS_PREC = 10; constexpr int INF = numeric_limits::max(); constexpr double EPS = 1e-9; // util {{{ template constexpr bool is_odd(T x) { return x % 2 == 1; } template constexpr bool is_even(T x) { return x % 2 == 0; } template constexpr int cmp(T x, T y) { return (x > y) - (x < y); } template constexpr int sgn(T x) { return cmp(x, T(0)); } template constexpr typename enable_if::value,T>::type modulo(T a, T b) { assert(b > 0); T r = a % b; return r >= 0 ? r : r+b; } template constexpr T clamp(T x, T lo, T hi) { assert(lo <= hi); if(x < lo) return lo; else if(x > hi) return hi; else return x; } int sqrti(int x) { assert(x >= 0); return static_cast(sqrt(x)); } s64 sqrtl(s64 x) { assert(x >= 0); return static_cast(sqrtl(x)); } template bool chmax(T& xmax, const T& x) { if(x > xmax) { xmax = x; return true; } else { return false; } } template bool chmin(T& xmin, const T& x) { if(x < xmin) { xmin = x; return true; } else { return false; } } template constexpr int SIZE(const T& c) { return static_cast(c.size()); } template constexpr int SIZE(const T (&)[N]) { return static_cast(N); } ostream& FPRINT(ostream& out) { return out; } template ostream& FPRINT(ostream& out, const T& x, const TS& ...args) { out << x; if(sizeof...(args)) out << ' '; return FPRINT(out, args...); } template ostream& FPRINTLN(ostream& out, const TS& ...args) { FPRINT(out, args...); return out << '\n'; } template ostream& FPRINTSEQ(ostream& out, InputIt first, InputIt last) { for(InputIt it = first; it != last; ++it) { if(it != first) out << ' '; out << *it; } return out; } template ostream& FPRINTARRAY1(ostream& out, const T (&c)[N]) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template ostream& FPRINTARRAY2(ostream& out, const T (&c)[N1][N2]) { out << '\n'; for(const auto& e : c) { FPRINTARRAY1(out, e) << '\n'; } return out; } template ostream& PRINT(const TS& ...args) { return FPRINT(cout, args...); } template ostream& PRINTLN(const TS& ...args) { return FPRINTLN(cout, args...); } template ostream& PRINTSEQ(InputIt first, InputIt last) { return FPRINTSEQ(cout, first, last); } template ostream& PRINTARRAY1(const T (&c)[N]) { return FPRINTARRAY1(cout, c); } template ostream& PRINTARRAY2(const T (&c)[N1][N2]) { return FPRINTARRAY2(cout, c); } template ostream& DPRINT(const TS& ...args) { return FPRINT(cerr, args...); } template ostream& DPRINTLN(const TS& ...args) { return FPRINTLN(cerr, args...); } template ostream& DPRINTSEQ(InputIt first, InputIt last) { return FPRINTSEQ(cerr, first, last); } template ostream& DPRINTARRAY1(const T (&c)[N]) { return FPRINTARRAY1(cerr, c); } template ostream& DPRINTARRAY2(const T (&c)[N1][N2]) { return FPRINTARRAY2(cerr, c); } template ostream& operator<<(ostream& out, const pair& p) { return out << '(' << p.first << ',' << p.second << ')'; } template ostream& operator<<(ostream& out, const vector& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, const vector>& c) { out << '\n'; for(const auto& e : c) { out << e << '\n'; } return out; } template ostream& operator<<(ostream& out, const deque& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, const list& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, const forward_list& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, const set& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, const unordered_set& c) { return out << set(cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, const array& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template ostream& FPRINTMAP(ostream& out, InputIt first, InputIt last) { out << "{\n"; for(auto it = first; it != last; ++it) { out << " " << it->first << " : " << it->second << '\n'; } out << "}\n"; return out; } template ostream& PRINTMAP(InputIt first, InputIt last) { return FPRINTMAP(cout, first, last); } template ostream& DPRINTMAP(InputIt first, InputIt last) { return FPRINTMAP(cerr, first, last); } template ostream& operator<<(ostream& out, const map& c) { return FPRINTMAP(out, cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, const unordered_map& c) { return out << map(cbegin(c), cend(c)); } template ostream& operator<<(ostream& out, stack c) { while(!c.empty()) { out << c.top(); c.pop(); if(!c.empty()) out << ' '; } return out; } template ostream& operator<<(ostream& out, queue c) { while(!c.empty()) { out << c.front(); c.pop(); if(!c.empty()) out << ' '; } return out; } template ostream& operator<<(ostream& out, priority_queue c) { while(!c.empty()) { out << c.top(); c.pop(); if(!c.empty()) out << ' '; } return out; } template bool alltrue(InputIt first, InputIt last) { return all_of(first, last, [](bool b) { return b; }); } template bool anytrue(InputIt first, InputIt last) { return any_of(first, last, [](bool b) { return b; }); } template bool allfalse(InputIt first, InputIt last) { return !anytrue(first, last); } template bool anyfalse(InputIt first, InputIt last) { return !alltrue(first, last); } struct pairhash { template size_t operator()(const pair& p) const { size_t ans = 17; ans = 31*ans + hash()(p.first); ans = 31*ans + hash()(p.second); return ans; } }; struct IosIni { IosIni() { cin.tie(nullptr); ios::sync_with_stdio(IOS_SYNCSTDIO); cout << fixed << setprecision(IOS_PREC); } } IOSINI; #define FOR(i, start, end) for(int i = (start); i < (end); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(f,c,...) (([&](decltype((c)) cc) { return (f)(begin(cc), end(cc), ## __VA_ARGS__); })(c)) #define DBG(x) DPRINTLN('L', __LINE__, ':', #x, ':', (x)) // }}} struct MyHash { size_t operator()(s64 key) const { return hash()(key) ^ 0xDEADBEEF; } }; int N, M; void solve() { unordered_map cnt; REP(_, N) { s64 a; cin >> a; ++cnt[a]; } REP(i, M) { s64 b; cin >> b; PRINT(cnt[b]); PRINT(i == M-1 ? '\n' : ' '); } } signed main(signed /*argc*/, char** /*argv*/) { cin >> N >> M; solve(); return 0; }