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

#TP0000046. Tổng của ba giá trị (Sum of Three Values)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng của ba giá trị (Sum of Three Values)

Sum of Three Values

Source: CSES

Version: Phuoc Hung OJ Extended

Problem Statement

You are given nn positive integers a1,a2,…,ana_1,a_2,\ldots,a_n and a positive integer xx. The array positions are numbered from 11 to nn.

Find three pairwise distinct positions i,j,ki,j,k satisfying

ai+aj+ak=x.a_i+a_j+a_k=x.

You may print the positions in any order. If several valid triples exist, output any one of them. If no valid triple exists, print IMPOSSIBLE.

Input

  • The first line contains two integers nn and xx, denoting the array length and the target sum.
  • The second line contains exactly nn positive integers a1,a2,…,ana_1,a_2,\ldots,a_n in positional order.

Output

If a solution exists, print three distinct indices from 11 through nn, separated by spaces, whose corresponding values sum to xx. Otherwise, print exactly IMPOSSIBLE.

Subtasks

  • Subtask 1 (20 points): 1≤n≤151\le n\le 15; 1≤x≤1091\le x\le10^9; 1≤ai≤1091\le a_i\le10^9 for every 1≤i≤n1\le i\le n.
  • Subtask 2 (30 points): 1≤n≤3001\le n\le 300; 1≤x≤1091\le x\le10^9; 1≤ai≤1091\le a_i\le10^9 for every 1≤i≤n1\le i\le n.
  • Subtask 3 (50 points): 1≤n≤50001\le n\le 5000; 1≤x≤1091\le x\le10^9; 1≤ai≤1091\le a_i\le10^9 for every 1≤i≤n1\le i\le n.

Examples

Input

4 8
2 7 5 1

Output

4 1 3

Explanation

The four array values are 2,7,5,12,7,5,1, and the target is 88. Positions 11, 33, and 44 contain 22, 55, and 11. Their sum is 2+5+1=82+5+1=8, so this triple is valid. Position 22 need not be selected. Other orders of the same three positions are also accepted.