#K41072. Find Pair Indices

    ID: 26784 Type: Default 1000ms 256MiB

Find Pair Indices

Find Pair Indices

You are given an array of integers and a target sum \(T\). Your task is to find two distinct elements in the array such that their sum equals \(T\). If such a pair exists, output the 1-indexed positions of these two elements. Otherwise, output -1.

You will be given multiple datasets to process. For each dataset, you should apply the same procedure independently.

Note: If there are multiple valid pairs, return the first pair found based on the order of appearance.

inputFormat

The input is read from stdin and has the following format:

  • The first line contains an integer \(D\) representing the number of datasets.
  • For each dataset:
    • The first line contains two integers \(N\) and \(T\) where \(N\) is the number of integers in the array and \(T\) is the target sum.
    • The second line contains \(N\) space-separated integers representing the array.

All input is provided via stdin.

outputFormat

For each dataset, output a single line to stdout:

  • If a valid pair exists, print the two 1-indexed positions separated by a space.
  • If no such pair exists, print -1.

Ensure that the outputs for multiple datasets are printed on separate lines in the order of the input.

## sample
2
5 9
2 7 11 15 1
4 8
1 2 3 4
1 2

-1

</p>