#K60682. Find Pairs with Sum
Find Pairs with Sum
Find Pairs with Sum
You are given a list of N integers and a target sum T. Your task is to find all distinct pairs of numbers a and b such that \(a + b = T\) (i.e., \(T = a + b\)). Each pair must be represented in ascending order (the smaller number first) and each unique pair should appear only once.
The answer should be printed in ascending order based on the first number and then the second.
inputFormat
The first line contains two space-separated integers N and T, where N is the number of elements in the list and T is the target sum.
The second line contains N space-separated integers.
outputFormat
For each valid pair, output a line with two integers separated by a space, where the first integer is the smaller number and the second is the larger. If no pairs exist, output nothing.
## sample5 10
2 8 3 7 1
2 8
3 7
</p>