#C8850. Find Pair with Target Sum

    ID: 52878 Type: Default 1000ms 256MiB

Find Pair with Target Sum

Find Pair with Target Sum

Given an array of integers and a target value \(T\), find one pair of indices \(i\) and \(j\) such that \(a_i + a_j = T\). The indices are 0-indexed.

If such a pair exists, output the indices; otherwise, output \(-1\). Note that if there are multiple valid pairs, returning any one pair is acceptable.

inputFormat

The first line contains two integers \(n\) and \(T\), where \(n\) is the number of elements in the array and \(T\) is the target sum.

The second line contains \(n\) space-separated integers representing the array.

outputFormat

If a valid pair is found, output two space-separated integers representing the indices of the pair. If no such pair exists, output \(-1\).

## sample
5 9
2 7 11 15 -2
0 1

</p>