#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  ;
  int a[n + 1];
  memset(a, 0, sizeof(a));
  for (long long i = 0; i < m; i++) {
    long long t;
    cin >> t;
    ;
    for (long long j = t; j < n + 1; j++) {
      if (a[j] == 0) a[j] = t;
    }
  }
  for (long long i = 1; i < n + 1; i++) {
    cout << a[i] << " ";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
