#K33627. Unique Pair Sum Finder
Unique Pair Sum Finder
Unique Pair Sum Finder
You are given an array of integers and a target integer \(K\). Your task is to find all unique pairs of numbers in the array such that the sum of the two numbers is exactly \(K\). Each pair \((a, b)\) should be output with the smaller number first, and the final list of pairs should be sorted in ascending order (first by the first element, then by the second).
Note: Each number from the array can be used at most once in a pair and duplicate pairs should be avoided.
Example:
Input: 5 9 2 7 4 5 3</p>Output: 2 7 4 5
inputFormat
The first line of input contains two integers \(n\) and \(K\) separated by a space, where \(n\) is the number of elements in the array and \(K\) is the target sum. The second line contains \(n\) integers separated by spaces representing the array.
outputFormat
For each unique pair that sums to \(K\), output a line with the two integers separated by a space. The pairs should be output in ascending order. If there are no valid pairs, output nothing.
## sample5 9
2 7 4 5 3
2 7
4 5
</p>