// AOJ 1367: Rearranging a Sequence
// 2017.10.9 bal4u@uu
// 2018.1.8

#include <stdio.h>

typedef struct { int id, a; } T;
T tbl[200002];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

#define THRESHOLD 10
#define STACKSIZE 35		// 2^32 for int

void quicksort(T *a, int n)
{
	int i, j, l, r, p;
	int lsp[STACKSIZE], rsp[STACKSIZE];
	T t, *m;
	
	l = 0, r = n-1, p = 0;
	while (1) {
		if (r-l <= THRESHOLD) {
			if (!p--) break;
			l = lsp[p], r = rsp[p];
		}
		m = a + ((l+r)>>1);
		i = l, j = r;
		while (1) {
			while (a[i].id < m->id) i++;
			while (m->id < a[j].id) j--;
			if (i >= j) break;
			t = a[i], a[i] = a[j], a[j] = t;
			i++, j--;
		}
		if (i-l > r-j) {
			if (i-l > THRESHOLD) {
				lsp[p] = l;
				rsp[p] = i-1;
				p++;
			}
			l = j+1;
		} else {
			if (r-j > THRESHOLD) {
				lsp[p] = j+1;
				rsp[p] = r;
				p++;
			}
			r = i-1;
		}
	}
	
	// insert sorting
	for (i = 1; i < n; i++) {
		t = a[i];
		for (j = i-1; j >= 0 && a[j].id > t.id; j--) a[j+1] = a[j];
		a[j+1] = t;
	}
}

int main()
{
	int n, m, i, j;
	register T *tp;

	n = in(), m = in();
	tp = tbl+1, j = n; for (i = 1; i <= n; i++) tp->id = j--, tp->a = i, tp++;

	while (m-- > 0) tbl[in()].id = i++;

	quicksort(tbl+1, n);
	n++; while (--n > 0) printf("%d\n", tbl[n].a);
	return 0;
}

