#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
void yash() {
  long long n, m, a, flag = 0;
  ;
  cin >> n >> m;
  long long maxi = n, arr[n];
  for (long long i = 0; i < m; i++) {
    cin >> a;
    for (long long j = a; j <= maxi; j++) {
      arr[j] = a;
      flag = 1;
    }
    if (flag == 1) maxi = a - 1;
    flag = 0;
  }
  for (long long i = 1; i <= n; i++) cout << arr[i] << " ";
  cout << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  yash();
  return 0;
}
