#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j;
  cin >> n >> m;
  int x, l[n];
  for (i = 0; i < n; i++) l[i] = 0;
  while (m--) {
    cin >> x;
    for (i = x - 1; i < n; i++) {
      if (l[i] == 0) l[i] = x;
    }
  }
  for (i = 0; i < n; i++) cout << l[i] << " ";
  cout << endl;
  return 0;
}
