Problem list
Log in
#r03330 · Online Judge > GoldOJ

Two Sum

Silver II 2.0 s 256 MB

Given an array of $n$ positive integers and a target $x$, find two elements at different positions whose sum is exactly $x$. Print their $1$-based indices (smaller index first). Among all valid pairs choose the one with the smallest first index, breaking ties by the smallest second index. Print IMPOSSIBLE if no pair works.

Input

First line $n$ and $x$; second line $n$ integers ($1 \le a_i \le 10^9$).

Output

Print the two indices, or IMPOSSIBLE.

Example 1

Input
4 8
2 7 5 1
Output
2 4
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code