#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> in;
  vector<int> out;
  int n, m, temp;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> temp;
    in.push_back(temp);
  }
  if (n == 1)
    cout << 1;
  else {
    out.push_back(0);
    out.push_back(1);
    for (int i = 2; i <= n; i++) {
      for (int j = 0; j < in.size(); j++) {
        if (in[j] <= i) {
          out.push_back(in[j]);
          break;
        }
      }
    }
    for (int i = 1; i < out.size(); i++) cout << out[i] << " ";
  }
  return 0;
}
