AlgoUniversity
  • Go Back
Treasure Room Easy :

Author

admin

Difficulty Level : Medium

Submissions : 18

Asked In :

Marks :20

: 0 | : 0

You have been exploring the tomb of some long dead person. There is a treasure room here full of vast riches. However, the door to it requires some trickery to unlock. There are $$$N$$$ blocks of varied lengths available to you. The $$$i$$$-th block has length $$$l_i$$$.

On both sides of the door, you must place one block each. Only when the sum of lengths of the blocks is equal to the width of the door will the door open. The width of the door is $$$W$$$.

So, you should pick two blocks $$$i$$$ and $$$j$$$ such that $$$l_i + l_j = W$$$. Which blocks should you pick?

Input

Two integers on the first line, $$$N$$$ $$$W$$$.

$$$N$$$ integers on the second line where the $$$i$$$-th integer is $$$l_i$$$.

Constraints

$$$1 \leq N \leq 10^6$$$

$$$1 \leq W \leq 10^6$$$

$$$1 \leq l_i \leq 10^6$$$

Output

Any two distinct integers $$$i$$$ and $$$j$$$ such that $$$l_i + l_j = W$$$. If it is impossible, output $$$-1$$$.

Examples

Input
7 8
7 5 3 6 9 2 9
Output
2 3
Input
12 9
4 19 14 18 1 14 8 15 19 19 2 9
Output
5 7

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.