p00946 Rearranging a Sequence
Example

Input

5 3
4
2
5


Output

5
2
4
1
3
```python
n, m = map(int, input().split())
E = [int(input()) for i in range(m)]
s = set()
E.reverse()

F = []
for e in E:
    if e in s:
        continue
    s.add(e)
    F.append(e)
for i in range(1, n+1):
    if i in s:
        continue
    F.append(i)
*_,=map(print,F)
```