#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; vector A(N); for (int i = 0; i < N; ++i) { cin >> A[i]; } sort(A.begin(), A.end()); vector counts; counts.reserve(M); for (int i = 0; i < M; ++i) { long long x; cin >> x; auto l = lower_bound(A.begin(), A.end(), x); auto r = upper_bound(A.begin(), A.end(), x); counts.push_back(r - l); } for (int i = 0; i < M; ++i) { if (i > 0) cout << ' '; cout << counts[i]; } cout << '\n'; return 0; }