#include <bits/stdc++.h>
using namespace std;
struct Node {
  bool mark = 1;
  int index = -5;
};
int a[110];
Node node[110];
int main() {
  int n, m;
  int i, j, k, l;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 1; i <= m; i++) {
    for (j = a[i]; j <= n; j++) {
      if (node[j].mark == 1) {
        node[j].mark = 0;
        node[j].index = a[i];
      }
    }
  }
  for (i = 1; i <= n; i++) printf("%d ", node[i].index);
  return 0;
}
