#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[1001];
  int checkarr[1001];
  for (int i = 0; i < 1000; i++) checkarr[i] = -1;
  for (int i = 0; i < m; i++) cin >> arr[i];
  for (int i = 0; i < m; i++) {
    int temp = arr[i] - 1;
    for (int j = temp; j < n; j++)
      if (checkarr[j] == -1) {
        checkarr[j] = arr[i];
      }
  }
  for (int i = 0; i < n; i++) printf("%d ", checkarr[i]);
  return 0;
}
