#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int N, M;
    cin >> N >> M;
    
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    
    for (int i = 0; i < M; ++i) {
        long long b;
        cin >> b;
        auto lower = lower_bound(A.begin(), A.end(), b);
        auto upper = upper_bound(A.begin(), A.end(), b);
        cout << (upper - lower) << (i == M - 1 ? "\n" : " ");
    }
    
    return 0;
}