#include <stdio.h> #include <stdlib.h> int cmp(const void* a, const void* b) { return *((int*)b) - *((int*)a); } int main() { int n, m; while (scanf("%d %d", &n, &m) != EOF) { if (n == 0 && m == 0) { break; } int a[n]; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } qsort(a, n, sizeof(a[0]), cmp); if (n < m) { for (int i = 0; i < n; i++) { printf("%d ", a[i]); } printf("\n"); } else { for (int i = 0; i < m; i++) { printf("%d ", a[i]); } printf("\n"); } } return 0; }