#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000;
int n, m;
int M[1000];
int A[1000];
int main() {
  cin >> n >> m;
  int d = 0;
  for (int i = 0; i < m; ++i) {
    cin >> d;
    for (int i = d; i <= n; ++i)
      if (A[i] == 0) A[i] = d;
  }
  for (int i = 1; i <= n; ++i) cout << A[i] << " ";
  cout << endl;
  return 0;
}
