ByteMonk logo
All problems

easy · 421 tests

Two Sum

You are given an array of n integers and a target k. Print the indices (0-based, smaller first) of the two distinct elements whose sum is exactly k. Exactly one such pair exists in every case.

Input

Line 1: t, the number of cases (1 <= t <= 1000).

Then t cases, each two lines:

  • n k (2 <= n <= 10^5, -10^9 <= k <= 10^9)
  • n integers, each in [-10^9, 10^9]

The total of n over one input is at most 10^6.

Output

For each case, one line: two integers i j with i < j, separated by a space.

Note

An element may not be used twice: for [3, 5] and k = 6 there is no answer from 3 + 3. An O(n^2) solution will time out on the larger tests.

Samples

Input 1

1
4 9
2 7 11 15

Output 1

0 1

Input 2

1
3 6
3 2 4

Output 2

1 2

Input 3

1
2 6
3 3

Output 3

0 1

Input 4

1
5 -8
-1 -2 -3 -4 -5

Output 4

2 4

Input 5

1
4 0
0 4 3 0

Output 5

0 3

Scoring

  1. Basic correctness20 pts
  2. Edge cases15 pts
  3. Random small20 pts
  4. Random large15 pts
  5. Adversarial10 pts
  6. Performance20 pts
2s · 256 MB
Two Sum · Coding · ByteMonk