#K84307. Find the Oldest Bikes

    ID: 36390 Type: Default 1000ms 256MiB

Find the Oldest Bikes

Find the Oldest Bikes

You are given T test cases. For each test case, you are given an integer N representing the number of bikes, a list of N bike identification numbers, and an integer K.

Your task is to select the K bikes with the smallest identification numbers—that is, the oldest bikes—and then print these K numbers in ascending order.

The sorting criterion can be expressed in latex as follows:

$$\text{Let } A = [a_1, a_2, \dots, a_N] \text{ be the bike IDs, then the answer is } sorted(\{a_1, a_2, \dots, a_N\})[0:K].$$

Read the input from standard input and write the output to standard output.

inputFormat

The input begins with an integer T on a single line, denoting the number of test cases.

Each test case consists of two lines:

  1. A line containing two integers N and K (the number of bikes and the number of oldest bikes to choose).
  2. A line with N space-separated integers representing the bike identification numbers.

You need to process each test case independently.

outputFormat

For each test case, output a single line containing the K smallest bike IDs in ascending order, separated by single spaces.

## sample
2
5 3
102 204 101 203 103
4 2
7 5 9 3
101 102 103

3 5

</p>