Pair with Target Sum

easy hashing arrays 1000 ms · 256 MB

Pair with Target Sum

You are given an array a of n integers and an integer t. Find two different positions i ≠ j such that a_i + a_j = t.

Input

The first line contains two integers n and t (2 ≤ n ≤ 2·10^5, -2·10^9 ≤ t ≤ 2·10^9).

The second line contains n integers a_1, …, a_n (-10^9 ≤ a_i ≤ 10^9).

Output

Print two 1-based indices i j with a_i + a_j = t. If several pairs exist, print any of them. If no such pair exists, print -1.

Any correct answer is accepted.

Example 1

Input

4 9
2 7 11 15

Output

1 2

Example 2

Input

3 4
2 5 7

Output

-1

Hints · reveal one at a time if you're stuck

Hint 1

Trying every pair is O(n²), which is too slow for n = 2·10^5. Once you fix one element a_j, how many values could its partner possibly have?

Hint 2

The partner of a_j must be exactly t − a_j, so you only need a fast "have I seen this value, and where?" lookup: a hash map. Be careful that a position is never paired with itself, e.g. when t = 2·a_j.

report an issue Prefer your own editor? sooks prep 2 (CLI)
Sign in to run code

Run your code on the examples, or submit it against every test.