Skip to content
UPEEC

Two Sum

Easy#arrays#hashing· solved by 0 · time limit 2.0 s

Find indices i<ji < j with ai+aj=ta_i + a_j = t. If several pairs work, print the one with the smallest jj, and for that jj the smallest ii. Print -1 if no pair exists. Indices are 0-based.

Input

nn, then nn integers, then tt.

Output

i j or -1.

Constraints

2≤n≤1052 \le n \le 10^5. A hash map gives O(n)O(n).

Sample 1

Input

4
2 7 11 15
9

Output

0 1

Sample 2

Input

3
1 2 3
7

Output

-1

Sign in or join free to run and submit your solution.