#K12506. Find Pair with Sum

    ID: 23705 Type: Default 1000ms 256MiB

Find Pair with Sum

Find Pair with Sum

In this problem, you are given a list of integers and a target integer (T). Your task is to determine whether there exists a pair of distinct elements (a) and (b) in the list such that (a + b = T). If such a pair exists, output the two integers (the order does not matter); otherwise, output "None".

Formally, given a list (L) and a target (T), find two distinct indices (i) and (j) such that (L_i + L_j = T), where (L_i \in L) and (L_j \in L). If there are multiple solutions, any one of them is acceptable.

inputFormat

Input is given via standard input (stdin). The first line of input contains two integers: (n) (the number of elements in the list) and (T) (the target sum). The second line contains (n) space-separated integers representing the list.

outputFormat

Output the two integers (separated by a space) that sum up to (T) if such a pair exists. If no such pair exists, output the string "None" without quotes.## sample

6 8
5 20 3 4 2 10
5 3