#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<int> B;
  vector<bool> vis;
  map<int, int> Mymap;
  map<int, int>::iterator it;
  cin >> n >> m;
  B.resize(m);
  vis.resize(100);
  for (int i = 0; i < m; i++) cin >> B[i];
  for (int i = 0; i < m; i++) {
    int x = B[i];
    for (int j = 1; j <= n; j++) {
      if (j >= x) {
        if (!vis[j]) Mymap[j] = x;
        vis[j] = 1;
      }
    }
  }
  int c = 0;
  for (it = Mymap.begin(); it != Mymap.end(); it++) {
    for (int i = 1; i <= n; i++) {
      if (i == it->first) {
        if (c != n - 1)
          cout << it->second << " ";
        else
          cout << it->second;
      }
    }
    c++;
  }
  cout << endl;
}
