#include <bits/stdc++.h>
using namespace std;
int s[111];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  memset(s, 0, sizeof(s));
  while (m--) {
    int x;
    scanf("%d", &x);
    for (int i = x; i <= n; i++) {
      if (s[i] == 0) s[i] = x;
    }
  }
  printf("%d", s[1]);
  for (int i = 2; i <= n; i++) printf(" %d", s[i]);
  printf("\n");
  return 0;
}
