#CCBCHBAHAI0000075. Chèn x trước lần xuất hiện cuối cùng của y (Insert x Before the Last Occurrence of y)

Chèn x trước lần xuất hiện cuối cùng của y (Insert x Before the Last Occurrence of y)

Insert x Before the Last Occurrence of y

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

A static array has capacity CC and current logical size nn:

a0,a1,…,an−1,1≤n≤C.a_0,a_1,\ldots,a_{n-1},\qquad 1\le n\le C.

Given integers xx and yy, define

I={i∣0≤i<n, ai=y}.I=\{i\mid 0\le i<n,\ a_i=y\}.

If I≠∅I\ne\varnothing and n<Cn<C, let p=max⁡Ip=\max I and insert xx immediately before apa_p. The new array has size n+1n+1 and

$$b_i=\begin{cases} a_i,&0\le i<p,\\x,&i=p,\\a_{i-1},&p<i\le n.\end{cases}$$

If I=∅I=\varnothing or n=Cn=C, leave the array unchanged. Print the final logical size and array.

Input

The first line contains CC and nn. The second line contains a0,…,an−1a_0,\ldots,a_{n-1}. The third line contains xx and yy.

Output

Print the final logical size on the first line and the active array elements on the second line.

Subtask

Subtask 1 (20 points): 1≤n≤C≤101\le n\le C\le 10, ∣ai∣,∣x∣,∣y∣≤103|a_i|,|x|,|y|\le10^3.

Subtask 2 (30 points): 1≤n≤C≤50001\le n\le C\le5000, ∣ai∣,∣x∣,∣y∣≤106|a_i|,|x|,|y|\le10^6.

Subtask 3 (50 points): 1≤n≤C≤2⋅1051\le n\le C\le2\cdot10^5, ∣ai∣,∣x∣,∣y∣≤109|a_i|,|x|,|y|\le10^9.

Example

Input

8 6
4 2 7 2 9 5
100 2

Output

7
4 2 7 100 2 9 5

Explanation

The output follows directly from the mathematical definition above.