#P1225G. To Make 1

    ID: 2164 Type: RemoteJudge 2000ms 512MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>bitmasksconstructive algorithmsdpgreedynumber theory*3100

To Make 1

No submission language available for this problem.

Description

There are nn positive integers written on the blackboard. Also, a positive number k2k \geq 2 is chosen, and none of the numbers on the blackboard are divisible by kk. In one operation, you can choose any two integers xx and yy, erase them and write one extra number f(x+y)f(x + y), where f(x)f(x) is equal to xx if xx is not divisible by kk, otherwise f(x)=f(x/k)f(x) = f(x / k).

In the end, there will be a single number of the blackboard. Is it possible to make the final number equal to 11? If so, restore any sequence of operations to do so.

The first line contains two integers nn and kk — the initial number of integers on the blackboard, and the chosen number (2n162 \leq n \leq 16, 2k20002 \leq k \leq 2000).

The second line contains nn positive integers a1,,ana_1, \ldots, a_n initially written on the blackboard. It is guaranteed that none of the numbers aia_i is divisible by kk, and the sum of all aia_i does not exceed 20002000.

If it is impossible to obtain 11 as the final number, print "NO" in the only line.

Otherwise, print "YES" on the first line, followed by n1n - 1 lines describing operations. The ii-th of these lines has to contain two integers xix_i and yiy_i to be erased and replaced with f(xi+yi)f(x_i + y_i) on the ii-th operation. If there are several suitable ways, output any of them.

Input

The first line contains two integers nn and kk — the initial number of integers on the blackboard, and the chosen number (2n162 \leq n \leq 16, 2k20002 \leq k \leq 2000).

The second line contains nn positive integers a1,,ana_1, \ldots, a_n initially written on the blackboard. It is guaranteed that none of the numbers aia_i is divisible by kk, and the sum of all aia_i does not exceed 20002000.

Output

If it is impossible to obtain 11 as the final number, print "NO" in the only line.

Otherwise, print "YES" on the first line, followed by n1n - 1 lines describing operations. The ii-th of these lines has to contain two integers xix_i and yiy_i to be erased and replaced with f(xi+yi)f(x_i + y_i) on the ii-th operation. If there are several suitable ways, output any of them.

Samples

Sample Input 1

2 2
1 1

Sample Output 1

YES
1 1

Sample Input 2

4 3
7 8 13 23

Sample Output 2

YES
23 13
8 7
5 4

Sample Input 3

3 4
1 2 3

Sample Output 3

NO

Note

In the second sample case:

  • f(8+7)=f(15)=f(5)=5f(8 + 7) = f(15) = f(5) = 5;
  • f(23+13)=f(36)=f(12)=f(4)=4f(23 + 13) = f(36) = f(12) = f(4) = 4;
  • f(5+4)=f(9)=f(3)=f(1)=1f(5 + 4) = f(9) = f(3) = f(1) = 1.