In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 2nd
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #04 exercise sheet]


[AED012] Game Tournament

You really love Algorithmology, the new game from Data Structures Inc, which is making quite an entrance on the competitive gaming scene, with tournaments appearing all over the world. You are particularly interested in the Major Championships (known as the majors) that will be held next month and will determine the world champion. Based on the results of previous tournaments, you have a secret formula that allows to compute the exact skill level of each player, and you now want to determine what the top of the ranking in the majors will look like.

The Problem

Given the (distinct) skill levels Si of N players that will compete in the majors, your task is to compute the top K ranked players, that is the K highest values.

Input

The first line of the input contains two integers: N (the number of players) and K (the amount of top players you want to compute).

The second line contains S1 S2 ... SN, that is, N distinct integers indicating the skill level of the N competitors.

Output

The output should consist of K lines, indicating the K highest skill levels, sorted in decreasing order.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

1 ≤ N ≤ 105       Amount of Players
1 ≤ KN       Amount of top players you want to know
1 ≤ Si ≤ 109       Skill levels

Example Input 1 Example Output 1
8 3
12 42 7 3 9 5 10 15
42
15
12

Example Input 2 Example Output 2
10 5
63 84 47 4 31 50 25 70 6 48
84
70
63
50
48

Algorithms and Data Structures (L.EIC011) 2024/2025
DCC/FCUP & DEI/FEUP - University of Porto