Given a sorted array and a number X, find a pair in array whose sum is closest to X.
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a single integer N and X denoting the size of array and value of X.
The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of the array.
Print the pair whose sum is closest to X. If multiple pairs are possible print the largest sum pair.
1 <= T <= 100
2 <= N <= 100
0 <= X <= 500
10 22 28 29 30 40
1 2 3 4 5
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.