#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; if (N == 0) { counts = {}; } else { int current_count = 1; for (int i = 1; i < N; ++i) { if (A[i] == A[i-1]) { current_count++; } else { counts.emplace_back(A[i-1], current_count); current_count = 1; } } counts.emplace_back(A.back(), current_count); } for (int i = 0; i < M; ++i) { long long b; cin >> b; auto it = lower_bound(counts.begin(), counts.end(), make_pair(b, 0), [](const pair& x, const pair& y) { return x.first < y.first; }); if (it != counts.end() && it->first == b) { cout << it->second << " "; } else { cout << "0 "; } } return 0; }