#include <bits/stdc++.h>
int n, m;
int a[110], b[110];
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    int i, j;
    for (i = 0; i <= n; i++) a[i] = 0;
    for (i = 1; i <= m; i++) {
      scanf("%d", &b[i]);
    }
    for (i = m; i >= 1; i--)
      for (j = b[i]; j <= n; j++) a[j] = b[i];
    printf("%d", a[1]);
    for (i = 2; i <= n; i++) printf(" %d", a[i]);
    printf("\n");
  }
  return 0;
}
