 1

# Team Formation

Difficulty: EASY

Problem Statement
Suggest Edit

#### Note: There always exists a pair in ‘ARR’ that has the sum less than or equal to ‘X - 30’ and the second integer must be larger than the first integer.

##### Input Format:
``````The first line contains a single integer ‘T’ representing the number of test cases.

The first line of each test case will contain one integer ‘N’ and ‘X’, that denotes the size of the ‘ARR’ and runs you need to come close to with the help of your team.

The second line of each test case contains ‘N’ space-separated integers ‘ARR[i]’, which denoting the numbers present in our ‘ARR’.
``````
##### Output Format:
``````For each test case, return a pair of integers denoting the closest pairs of values which have the highest runs combined.

Output for every test case will be printed in a separate line.
``````
##### Note:
``````You don’t need to print anything; It has already been taken care of.
``````
##### Constraints:
``````1 <= T <= 5
1 <= N <= 10^5
0 <= A[i], X <= 10^9

Time Limit: 1 sec
``````
##### Sample Input 1:
``````2
6 140
50 20 35 110 150 45
5 150
50 70 35 100 50
``````
##### Sample Output 1:
``````45 50
50 70
``````
##### Explanation For Sample Input 1:
``````In the first test case, the possible pairs of answers are [ 50, 20], [ 50, 35], [ 50, 45],  [ 20, 35], [ 20, 45], and  [ 35, 45]. But the closest we can come to ‘X’ can be achieved by the pair [ 50, 45] as the sum of them is 95 while the rest are smaller than it.

In the second test case, the possible pairs of answers are [ 50, 70], [ 50, 35], [ 50, 50],  [ 70, 35], and  [ 35, 50]. But the closest we can come to ‘X’ can be achieved by the pair [ 50, 70] as the sum of them is 110 while the rest are smaller than it.
``````
##### Sample Input 2:
``````2
2 140
5 10
5 130
80 120 35 25 75
``````
##### Sample Output 2:
``````5 10
25 75
``````
##### Explanation For Sample Input 2:
``````In the first test case, there is only one pair [5,10] which gives the sum less than or equal to 110.
In the second test case also there is only one pair [25,75] which gives the sum less than or equal to 100. So, we will return [25, 75].
``````   Console