#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j;
  cin >> n >> m;
  int l[n + 1];
  for (i = 0; i < n + 1; ++i) l[i] = 0;
  for (i = 0; i < m; ++i) {
    cin >> j;
    for (int k = j; k < n + 1; ++k)
      if (!l[k]) l[k] = j;
  }
  for (i = 1; i < n + 1; ++i) cout << l[i] << ' ';
  return 0;
}
