#K88847. Pair Sum Finder

    ID: 37399 Type: Default 1000ms 256MiB

Pair Sum Finder

Pair Sum Finder

You are given an array of integers and a target integer \(K\). Your task is to find two distinct elements \(a\) and \(b\) from the array such that \(a + b = K\). If such a pair exists, output the two numbers separated by a space (i.e. a b). If there is no such pair, output No pair found.

The input consists of several test cases. For each test case, the first line contains two integers \(N\) and \(K\), where \(N\) is the number of elements in the array and \(K\) is the target sum. The next line contains \(N\) space-separated integers representing the array elements.

Note: A valid pair is formed by two distinct positions in the array. The pair returned should be the first valid pair found based on the order of scanning the array.

inputFormat

The first line of input contains an integer \(T\) representing the number of test cases. Then for each test case, there are two lines of input:

  • The first line contains two integers \(N\) and \(K\) separated by a space.
  • The second line contains \(N\) space-separated integers representing the array elements.

outputFormat

For each test case, output a single line. If a pair \((a, b)\) exists such that \(a + b = K\), print the two numbers separated by a space. Otherwise, print No pair found.

## sample
4
5 9
2 7 11 15 1
4 16
1 2 3 4
4 2
1 1 1 1
3 10
5 5 5
2 7

No pair found 1 1 5 5

</p>