#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> arr(n);
  long long int r = n;
  for (long long int i = 0; i < k; i++) {
    long long int temp;
    cin >> temp;
    for (long long int j = temp - 1; j < r; j++) arr[j] = temp;
    r = min(r, temp - 1);
  }
  for (auto z : arr) cout << z << " ";
  return 0;
}
