#K36667. Find Two Sum Indices
Find Two Sum Indices
Find Two Sum Indices
Given an array of integers and a target integer \(T\), determine whether there exist two distinct indices \(i\) and \(j\) such that \(a_i + a_j = T\). The indices are based on 0-indexing. If multiple valid pairs exist, return the first one found. Otherwise, output -1.
Example:
Input: 4 9 2 7 11 15 Output: 0 1
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 integer. The second line contains \(n\) space-separated integers representing the array.
outputFormat
If a valid pair is found, print the two indices separated by a single space. If no such pair exists, print -1.
## sample4 9
2 7 11 15
0 1