LearnPy Hub
← Arena
IntermediateRating 1300

Top K Frequent

Print the k most frequent values, most frequent first (ties: smaller value first).

Input

n k, then n integers.

Output

One line.

Sample 1

Input
6 2
1 1 1 2 2 3
Output
1 2

Sample 2

Input
1 1
1
Output
1
solution.py
Output appears here
Top K Frequent · Python Arena problem · LearnPy Hub