Example

Input

5 3
4
2
5


Output

5
2
4
1
3
#include <iostream>
#define REP(i, a, n) for(int i = a; i <= n; i++)
using namespace std;


int nxt[200002], prv[200002], n, m;

int main(void) {
  cin >> n >> m;

  int h = 1;
  REP(i, 0, n + 1) {
    nxt[i] = i + 1;
    prv[i] = i - 1;
  }

  int e, ntmp, ptmp;
  REP(i, 1, m) {
    cin >> e;
    if(h != e) {
      nxt[prv[e]] = nxt[e];
      prv[nxt[e]] = prv[e];
      nxt[e] = h;
      prv[e] = 0;
      nxt[0] = e;
      prv[h] = e;
      h = e;
    }
  }

  int k = h;
  REP(i, 1, n) {
    cout << k << endl;
    k = nxt[k];
  }

  return 0;
}