#P336. 【例57.3】火星人
【例57.3】火星人
Explanation
Humanity finally landed on the land of Mars and met the mysterious Martians. Both humans and Martians cannot understand each other's language, but our scientists have invented a method of communication using numbers. This communication method goes like this: first, the Martians tell a very large number to human scientists. After the scientists decipher the meaning of this number, they add a very small number to the large number and tell the Martians the result as a response from humans.
Martians use a very simple way to represent numbers - by breaking their fingers. Martians only have one hand, but this hand has thousands of fingers arranged in a row, numbered as , , . Any two fingers of a Martian can switch positions freely, and they count using this method.
A Martian demonstrated how to count with fingers using a human hand. If five fingers - thumb, index finger, middle finger, ring finger, and little finger - are numbered as , , , , and respectively, when they are arranged in normal order, they form a digit of . When you swap the positions of the ring finger and little finger, a digit of is formed.When you completely reverse the order of the five fingers, will be formed. Among all the digits that can be formed, is the smallest, representing ; is the second smallest, which represents ;is the maximum, which represents . The following table shows the digits that can be formed with only fingers and the numbers they represent:
The three in one system number represents the number
Now you are fortunate to be the first Earthling to communicate with a Martian. A Martian will show you his fingers, and scientists will tell you the very small numbers to add. Your task is to add the numbers represented by Martian fingers to the numbers told to you by scientists, and change the order of Martian fingers based on the addition result. Input data to ensure that the result does not exceed the range that Martian fingers can represent.
Input format
Three lines, the first line has a positive integer , representing the number of Martian fingers (). The second line is a positive integer , representing the small integer to be added (). The next line is an arrangement of N integers from to , separated by spaces, representing the order in which Martian fingers are arranged.
Output format
There is only one line, which contains integers representing the changed arrangement order of Martian fingers. Separate every two adjacent numbers with a space in between, without any extra spaces.
Example
5
3
1 2 3 4 5
1 2 4 5 3