p-1000

Two Sum

Easy

Given an integer array nums and an integer target, return indices of two numbers such that they add up to target. If no such pair exists, output -1 -1.

Input Format

Line 1: n target
Line 2: n space-separated integers

Output Format

Two space-separated indices i j (0-based). Output -1 -1 if no valid pair exists.

Constraints

  • 2 <= n <= 20000
  • -10^9 <= nums[i], target <= 10^9
  • At most one valid answer per test case

Examples

Input
4 9
2 7 11 15
Output
0 1
Explanation

2 + 7 = 9, so indices 0 and 1 are returned.

Input
5 100
1 2 3 4 5
Output
-1 -1
Explanation

No two numbers add up to 100.

Hints

Hint 1
Hint 2
Code
>
Input
Expected Output
0 1
2 + 7 = 9, so indices 0 and 1 are returned.

Run uses the currently selected testcase. Submit always evaluates your code against the full hidden test suite from the database.