#C12329. Unique Pair Sums

    ID: 41744 Type: Default 1000ms 256MiB

Unique Pair Sums

Unique Pair Sums

You are given an array of n integers and a target sum target. Your task is to find all unique pairs of integers in the array such that the sum of the two numbers is exactly target. Each element in the array can be used at most once.

For each pair, print the two numbers in non‐decreasing order (i.e. the smaller number first). In order to have a consistent output, sort the pairs in lexicographical order (first by the first element, then by the second element). If there is no valid pair, output -1.

Note: The input is provided via standard input and the output should be printed to standard output.

inputFormat

The first line of input contains two space-separated integers n and target, where n denotes the number of elements in the array and target is the target sum. The second line contains n space-separated integers representing the array.

outputFormat

Print each unique pair of integers whose sum equals target on a separate line. Each pair should be printed as two space-separated integers (with the smaller number first). The pairs must be listed in lexicographical order. If no such pair exists, print -1.

## sample
6 6
1 2 3 4 3 5
1 5

2 4 3 3

</p>