Median mountain range
문제
Berland -- is a huge country with diverse geography. One of the most famous natural attractions of Berland is the "Median mountain range". This mountain range is mountain peaks, located on one straight line and numbered in order of to . The height of the -th mountain top is .
"Median mountain range' is famous for the so called alignment of mountain peaks happening to it every day. At the moment of alignment simultaneously for each mountain from to its height becomes equal to the median height among it and two neighboring mountains. Formally, if before the alignment the heights were equal , then after the alignment new heights are as follows: , and for all from to median. The median of three integers is the second largest number among them. For example, median, and median.
Recently, Berland scientists have proved that whatever are the current heights of the mountains, the alignment process will stabilize sooner or later, i.e. at some point the altitude of the mountains won't changing after the alignment any more. The government of Berland wants to understand how soon it will happen, i.e. to find the value of --- how many alignments will occur, which will change the height of at least one mountain. Help scientists solve this important problem!
Note that in some test groups, in addition to the value, you will need to determine the mountain heights after the alignments, i.e. the heights of the mountains as they will stay forever.
입력
The first line contains integers and (, ) --- the number of mountains and the parameter describing whether it's required to determine the final heights of the mountains.
The second line contains integers () --- current heights of the mountains.
출력
In the first line print --- the number of alignments, which change the height of at least one mountain.
In case , the second line should contain integers --- the final heights of the mountains after alignments.
힌트
In the first example, the heights of the mountains at index and never change. Since the median of , , is , the second and the fourth mountains will have height 1 after the first alignment, and since the median of , , is , the third mountain will have height 2 after the first alignment. This way, after one alignment the heights are , , , , . After the second alignment the heights change into , , , , and never change from now on, so there are only alignments changing the mountain heights.
In the third examples the alignment doesn't change any mountain height, so the number of alignments changing any height is . Since , you shouldn't print the resulting heights of the mountains.
예제
예제 1
5 1 1 2 1 2 1
2 1 1 1 1 1
예제 2
6 1 1 3 2 5 4 6
1 1 2 3 4 5 6
예제 3
6 0 1 1 2 2 1 1
0