Олимпиадный тренинг

Задача 38295. I just need help!


Dr. Rita has a hard day at work today and has gone on her lunch break. During this time, a queue of n people lined up at her office! The queue is long, so the room quickly became very stuffy.

For convenience, let's number the patients with natural numbers from 1 to n in the order in which they initially stood in line: the first was the person with number 1, the second — with number 2 , and so on. The last person was number n.

Further, until Rita returned from lunch, the following event occurred t times: someone from the queue became very stuffy. Because of this, he went outside to get some fresh air, and immediately returned back, standing at the end of the line.

The attentive patient Arseniy wrote down the numbers of everyone who went out to breathe, in the order in which this happened. Now Arseniy is interested in the order in which people stand in line. Help him figure it out!

It is known that no one left the queue completely and no one new came. The next person went out to breathe only after the previous person who went out to breathe returned to the end of the queue.

Input
The first line of the input contains two numbers n and t — the number of people in the queue and the number of events that the person went outside to breathe ( 1 ≤ n , t ≤ 100 000 ).

The second line of the input contains t integers a i ( 1 ≤ ai ≤ n ) — numbers of people who went out to breathe and then stood at the end of the line in the order in which they did it.

Imprint
Print n numbers — people's numbers in order of priority after all permutations.

Note
In the test from the example, the following changes occurred with the queue:

Person number 2 has moved to the end. People order: 1 , 3 , 4 , 2
Person number 3 moved to the end. People order: 1 , 4 , 2 , 3
Person number 1 has moved to the end. People order: 4 , 2 , 3 , 1
Person number 2 has moved to the end. People order: 4 , 3 , 1 , 2
Person number 1 has moved to the end. People order: 4 , 3 , 2 , 1
Order of people in line at the end: 4 , 3 , 2 , 1 .
 
Examples
# Input Output
1 4 5
2 3 1 2 1
4 3 2 1