#include <bits/stdc++.h>
using namespace std;
int arr[105];
int main() {
  int n, m;
  cin >> n >> m;
  int akh = n;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    for (int j = x; j <= akh; j++) {
      arr[j] = x;
    }
    if (x <= akh) akh = x - 1;
  }
  for (int i = 1; i <= n; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}
