Two Sum
View as PDFYou are given an array of integers and a target sum.
Find two distinct positions whose values add up to the target.
It is guaranteed that exactly one valid pair exists.
Input
The first line contains two integers and
, the size of the array and the target sum.
The second line contains integers:
.
Output
Print two space-separated integers and
(
), the 1-indexed positions of a pair such
that
.
Constraints
- Exactly one valid pair exists.
Example 1
Input
4 9
2 7 11 15
Output
1 2
Example 2
Input
5 6
3 2 4 8 10
Output
2 3
Example 3
Input
5 10
-1 4 9 11 2
Output
1 4
Comments