#include <bits/stdc++.h>
using namespace std;
int a[200] = {0};
int main() {
  int i, n, m, ans = 0, b[200], j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) scanf("%d", &b[i]);
  for (i = 1; i <= m; i++) {
    int p = b[i];
    for (j = p; j <= n; j++) {
      if (a[j] == 0) a[j] = b[i];
    }
  }
  for (i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
