PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#TP0000030. Tổng của hai giá trị (Sum of Two Values)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tổng của hai giá trị (Sum of Two Values)

Sum of Two Values

Source: CSES

Version: Phuoc Hung OJ Extended

Problem Statement

You are given an array of nn integers a1,a2,…,ana_1,a_2,\ldots,a_n and a target xx. Find two distinct positions ii and jj satisfying ai+aj=xa_i+a_j=x. Positions are numbered from 11 in the original array. You may output any valid pair. If none exists, report that a solution is impossible.

Input

  • The first line contains integers nn and xx: the array length and required sum.
  • The second line contains exactly nn integers a1,a2,…,ana_1,a_2,\ldots,a_n in their original order.

Output

Print any two distinct indices i,ji,j in [1,n][1,n] such that ai+aj=xa_i+a_j=x, in either order. If no such pair exists, print IMPOSSIBLE.

Subtasks

  • Subtask 1 (20 points): 1≤n≤81\le n\le 8; 1≤x≤1091\le x\le10^9; 1≤ai≤1091\le a_i\le10^9 for all 1≤i≤n1\le i\le n.
  • Subtask 2 (30 points): 1≤n≤20001\le n\le 2000; 1≤x≤1091\le x\le10^9; 1≤ai≤1091\le a_i\le10^9 for all 1≤i≤n1\le i\le n.
  • Subtask 3 (50 points): 1≤n≤2000001\le n\le 200000; 1≤x≤1091\le x\le10^9; 1≤ai≤1091\le a_i\le10^9 for all 1≤i≤n1\le i\le n.

Examples

Input

4 8
2 7 5 1

Output

4 2

Explanation

The array is [2,7,5,1][2,7,5,1] and the target is 88. Positions 44 and 22 hold 11 and 77, respectively. Their sum is 1+7=81+7=8, and the indices differ, so 4 2 is valid.