Problem Description

Given an array, print the k most frequent numbers. If frequency ties, smaller number comes first.

Input Format

Line1: n k. Line2: n integers.

Output Format

One line: k numbers.

Sample Test Case

Input:
10 3 1 1 2 2 2 3 3 4 4 4
Output:
2 1 4

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next