Key Insertion

No attempts yetTime limit1sMemory limit512 MB

Problem

As an employee of the Macrohard Company, you have been asked to implement a new data structure for storing integer keys.

The keys are kept in a special ordered collection that behaves like an array AA with infinitely many cells, numbered starting from 11. Initially every cell is empty. The collection supports a single operation, Insert(L,K)\text{Insert}(L, K), where LL is a cell index and KK is a positive integer.

Insert(L,K)\text{Insert}(L, K) is defined recursively:

  • If cell A[L]A[L] is empty, set A[L]KA[L] \leftarrow K.
  • If cell A[L]A[L] is already occupied, first perform Insert(L+1,A[L])\text{Insert}(L+1, A[L]), and then set A[L]KA[L] \leftarrow K.

You are given NN indices L1,L2,,LNL_1, L_2, \ldots, L_N. Starting from the empty array, perform the operations Insert(L1,1)\text{Insert}(L_1, 1), Insert(L2,2)\text{Insert}(L_2, 2), \ldots, Insert(LN,N)\text{Insert}(L_N, N) in this order, and output the final contents of the array.

Input

The first line contains two integers NN and MM: the number of Insert operations and the largest cell index that may be used in an operation (1N1310721 \le N \le 131072, 1M1310721 \le M \le 131072).

The second line contains NN integers L1,L2,,LNL_1, L_2, \ldots, L_N describing the operations to perform (1LiM1 \le L_i \le M).

Output

Output the contents of the array after all of the operations have been performed. On the first line, print WW, the largest index of a non-empty cell. On the second line, print the WW integers A[1],A[2],,A[W]A[1], A[2], \ldots, A[W], using 00 for empty cells.