#include using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; map mp; for (int i = 0; i < n; i++) { ll a; cin >> a; mp[a]++; } for (int i = 0; i < m; i++) { ll b; cin >> b; if (i) cout << " "; if (mp.find(b) == mp.end()) cout << 0; else cout << mp[b]; } cout << '\n'; }