#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-7;
int main() {
  double TIME_START = clock();
  int n, m;
  cin >> n >> m;
  vector<int> b(m);
  vector<int> ans(n + 5, 0);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < b.size(); i++) {
    for (int j = b[i]; j <= n; j++) {
      if (ans[j] == 0) {
        ans[j] = b[i];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
