#include <bits/stdc++.h>
using namespace std;
int brr[100000];
int main() {
  int n, m, i, j, k, l, t, r, e;
  cin >> n;
  cin >> m;
  int arr[m];
  for (i = 0; i < m; i++) {
    cin >> k;
    for (j = k; j <= n; j++) {
      if (brr[j] == 0) brr[j] = k;
    }
  }
  for (i = 1; i <= n; i++) {
    cout << brr[i] << " ";
  }
  cout << endl;
  return 0;
}
