#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, m = 0, temp = 0;
  cin >> n >> m;
  int arr[n + 1];
  fill(arr, arr + n + 1, -1);
  for (int i = 1; i <= m; i++) {
    cin >> temp;
    int k = temp;
    while (k <= n && arr[k] == -1) {
      arr[k] = temp;
      k++;
    }
  }
  for (int j = 1; j <= n; j++) cout << arr[j] << " ";
  return 0;
}
