#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long arr[m];
  for (long long i = 0; i < m; i++) {
    cin >> arr[i];
  }
  long long arr2[n];
  for (long long i = 0; i < n; i++) {
    arr2[i] = 0;
  }
  for (long long i = 0; i < m; i++) {
    for (long long j = arr[i] - 1; j < n; j++) {
      if (arr2[j] == 0) arr2[j] = arr[i];
    }
  }
  for (long long i = 0; i < n; i++) {
    cout << arr2[i] << " ";
  }
}
