#include <iostream> #include <algorithm> using namespace std; bool cmp (int x, int y){ return x > y; } int main () { int n, m; while (cin >> n >> m){ int arr[n]; if (n == 0 || m == 0){ break; } else{ for (int i = 0; i < n; i++){ cin >> arr[i]; } } sort (arr, arr + n, cmp); if (m > n){ for (int i = 0; i < n; i++){ cout << arr[i] << " "; } } else{ for (int i = 0; i < m; i++){ cout << arr[i] << " "; } } cout << endl; } return 0; }