#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t, n, m, i, j, k, x, l;
  string s;
  cin >> n >> m;
  long long by[n + 1];
  memset(by, 0, sizeof(by));
  while (m--) {
    cin >> x;
    for (i = x; i <= n; i++) {
      if (by[i] == 0)
        by[i] = x;
      else
        break;
    }
  }
  for (i = 1; i <= n; i++) cout << by[i] << " ";
  cout << '\n';
  return 0;
}
