#include #include #include using namespace std; int main() { ios_base::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 res; res.reserve(m); 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); res.push_back(upper - lower); } for (int i = 0; i < m; ++i) { if (i > 0) { cout << ' '; } cout << res[i]; } cout << '\n'; return 0; }