#C10807. Two Sum Indices (1-Indexed)
Two Sum Indices (1-Indexed)
Two Sum Indices (1-Indexed)
You are given an array of n integers and a target integer T. Your task is to find two distinct elements in the array such that their sum equals to $T$. The answer should be the 1-indexed positions of these two numbers in increasing order. If no such pair exists, output -1.
Note: Each input test case will contain exactly one correct answer or no answer at all.
Input/Output: Your program must read from stdin
and write to stdout
.
inputFormat
The input consists of two lines:
- The first line contains two integers: n (the number of elements in the array) and T (the target sum).
- The second line contains n space-separated integers representing the array.
It is guaranteed that 1 ≤ n ≤ 10^5 and the absolute values of the integers do not exceed 10^9.
outputFormat
If a pair exists whose sum equals to T, print the two 1-indexed positions in increasing order separated by a space. If no such pair exists, print -1.
## sample4 9
2 7 11 15
1 2
</p>