0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 01:58:48 +00:00
OI-codes/AcWing/838/838.cpp

22 lines
383 B
C++

#include <bits/stdc++.h>
using namespace std;
int n, m, t;
map<int, int> a;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> t;
a[t]++;
}
for (auto it = a.begin(); it != a.end(); it++) {
for (int i = 0; i < it->second && m; i++, m--) {
cout << it->first << ' ';
}
}
cout << endl;
return 0;
}