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