n, m = map(int, input().split()) a = sorted(list(map(int, input().split())), reverse=True) print(*a[:m])