#include <bits/stdc++.h>
int main() {
  int p[105];
  int n, m, i, j, t;
  memset(p, 0, sizeof(p));
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &t);
    for (j = t; p[j] == 0; j++) p[j] = t;
  }
  for (i = 1; i < n; i++) printf("%d ", p[i]);
  printf("%d\n", p[n]);
  return 0;
}
