#P1225G. To Make 1
To Make 1
No submission language available for this problem.
Description
There are positive integers written on the blackboard. Also, a positive number is chosen, and none of the numbers on the blackboard are divisible by . In one operation, you can choose any two integers and , erase them and write one extra number , where is equal to if is not divisible by , otherwise .
In the end, there will be a single number of the blackboard. Is it possible to make the final number equal to ? If so, restore any sequence of operations to do so.
The first line contains two integers and — the initial number of integers on the blackboard, and the chosen number (, ).
The second line contains positive integers initially written on the blackboard. It is guaranteed that none of the numbers is divisible by , and the sum of all does not exceed .
If it is impossible to obtain as the final number, print "NO" in the only line.
Otherwise, print "YES" on the first line, followed by lines describing operations. The -th of these lines has to contain two integers and to be erased and replaced with on the -th operation. If there are several suitable ways, output any of them.
Input
The first line contains two integers and — the initial number of integers on the blackboard, and the chosen number (, ).
The second line contains positive integers initially written on the blackboard. It is guaranteed that none of the numbers is divisible by , and the sum of all does not exceed .
Output
If it is impossible to obtain as the final number, print "NO" in the only line.
Otherwise, print "YES" on the first line, followed by lines describing operations. The -th of these lines has to contain two integers and to be erased and replaced with on the -th operation. If there are several suitable ways, output any of them.
Samples
Note
In the second sample case:
- ;
- ;
- .