#P1773L. Lisa's Sequences

Lisa's Sequences

Description

Lisa loves playing with the sequences of integers. When she gets a new integer sequence aia_i of length nn, she starts looking for all monotone subsequences. A monotone subsequence [l,r][l, r] is defined by two indices ll and rr (1l<rn1 \le l < r \le n) such that i=l,l+1,,r1:aiai+1\forall i = l, l+1, \ldots, r-1: a_i \le a_{i+1} or i=l,l+1,,r1:aiai+1\forall i = l, l+1, \ldots, r-1: a_i \ge a_{i+1}.

Lisa considers a sequence aia_i to be boring if there is a monotone subsequence [l,r][l, r] that is as long as her boredom threshold kk, that is when rl+1=kr - l + 1 = k.

Lucas has a sequence bib_i that he wants to present to Lisa, but the sequence might be boring for Lisa. So, he wants to change some elements of his sequence bib_i, so that Lisa does not get bored playing with it. However, Lucas is lazy and wants to change as few elements of the sequence bib_i as possible. Your task is to help Lucas find the required changes.

The first line of the input contains two integers nn and kk (3kn1063 \le k \le n \le 10^6) — the length of the sequence and Lisa's boredom threshold. The second line contains nn integers bib_i (1bi999991 \le b_i \le 99\,999) — the original sequence that Lucas has.

On the first line output an integer mm — the minimal number of elements in bib_i that needs to be changed to make the sequence not boring for Lisa. On the second line output nn integers aia_i (0ai1000000 \le a_i \le 100\,000), so that the sequence of integers aia_i is not boring for Lisa and is different from the original sequence bib_i in exactly mm positions.

Input

The first line of the input contains two integers nn and kk (3kn1063 \le k \le n \le 10^6) — the length of the sequence and Lisa's boredom threshold. The second line contains nn integers bib_i (1bi999991 \le b_i \le 99\,999) — the original sequence that Lucas has.

Output

On the first line output an integer mm — the minimal number of elements in bib_i that needs to be changed to make the sequence not boring for Lisa. On the second line output nn integers aia_i (0ai1000000 \le a_i \le 100\,000), so that the sequence of integers aia_i is not boring for Lisa and is different from the original sequence bib_i in exactly mm positions.

Sample Input 1

5 3
1 2 3 4 5

Sample Output 1

2
1 0 3 0 5

Sample Input 2

6 3
1 1 1 1 1 1

Sample Output 2

3
1 100000 0 1 0 1

Sample Input 3

6 4
1 1 4 4 1 1

Sample Output 3

1
1 1 4 0 1 1

Sample Input 4

6 4
4 4 4 2 2 2

Sample Output 4

2
4 4 0 2 0 2

Sample Input 5

6 4
4 4 4 3 4 4

Sample Output 5

1
4 4 100000 3 4 4

Sample Input 6

8 4
2 1 1 3 3 1 1 2

Sample Output 6

2
2 1 1 3 0 1 0 2

Sample Input 7

10 4
1 1 1 2 2 1 1 2 2 1

Sample Output 7

2
1 1 100000 2 2 100000 1 2 2 1

Sample Input 8

7 5
5 4 4 3 4 4 4

Sample Output 8

0
5 4 4 3 4 4 4

Sample Input 9

10 10
1 1 1 1 1 1 1 1 1 1

Sample Output 9

1
1 1 1 1 1 1 1 1 0 1