#K10331. Gift Card Combination

    ID: 23223 Type: Default 1000ms 256MiB

Gift Card Combination

Gift Card Combination

You are given n gift cards where each gift card has an integer value. Your task is to determine whether there exists exactly three gift cards whose total value is equal to a given target value P. If such a combination exists, output the three card values in ascending order. Otherwise, output -1.

The problem can be formally expressed using the equation:

[ a + b + c = P ]

where a, b, and c are the values of the chosen gift cards with the condition that they are taken from a sorted list in increasing order. The solution must read the input from the standard input (stdin) and print the result to the standard output (stdout).

Note: If multiple valid combinations exist, you should output the combination with the smallest lexicographical order (i.e. the first such valid combination when iterating over the sorted list).

inputFormat

The first line contains two space-separated integers: n (the number of gift cards) and P (the target sum).

The second line contains n space-separated integers, representing the values of the gift cards.

outputFormat

If there is a valid combination of exactly three gift cards that sum up to P, output the three values in ascending order, separated by spaces. Otherwise, output -1.

## sample
5 100
10 20 30 70 50
10 20 70

</p>