#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n, k; while (cin >> n >> k) { vector<int> vec; for (int i = 0; i < n; ++i){ int val; cin >> val; vec.push_back(val); } sort(vec.begin(),vec.end()); for (int i = 0; i < k; ++i){ cout << vec[i] << ' '; } cout << endl; } return 0; }