#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> visit(n + 1);
  vector<int> num(m);
  vector<int> res(n + 1);
  for (int i = 0; i < m; ++i) {
    cin >> num[i];
    int j = num[i];
    while (j <= n) {
      if (!visit[j]) {
        visit[j] = 1;
        res[j] = num[i];
      }
      j++;
    }
  }
  for (int i = 1; i < res.size(); ++i) cout << res[i] << " ";
  cout << endl;
  return 0;
}
