Inserting key values#5215

Inserting key values

2 seconds
64 megabytes
Easy

You have been hired by the company MacroHard to create a new data structure for storing integer key values.

This structure functions like an infinitely long array , with cells numbered starting from one. Initially, all cells are empty. The only operation you need to support is Insert(L, K), where is the position in the array, and is a positive integer key value.

The operation is executed as follows:

Given a sequence of integers L_1, L_2, \ldots, L_N, you need to output the contents of this array after executing the following sequence of operations:

Insert(L_1, 1)

Insert(L_2, 2)

Insert(L_N, N)

Input

The first line of the input file contains - the number of operations, and - the maximum position number that can be used in the operation. (1 \leq N \leq 131072, 1 \leq M \leq 131072). The next line contains integers L_i, which specify the operations (1 \leq L_i \leq M).

Output

Output the contents of the array after executing the given sequence of operations. On the first line, output - the number of the last non-empty position in the array. Then output integers - A_1, A_2, \ldots, A_W. For empty cells, output zeros.

Examples

Example 1

Loading
Loading