#include <bits/stdc++.h>
using namespace std;
int arr[100];
int rra[100];
int main() {
  int a, b, c, d = 0;
  cin >> a >> b;
  for (int i = 0; i < b; i++) cin >> arr[i];
  for (int i = 0; i < b; i++) {
    c = arr[i];
    d = 0;
    while (c <= a) {
      if (rra[d] == 0) rra[d] = arr[i];
      c++;
      d++;
    }
  }
  for (int i = a - 1; i >= 0; i--) cout << rra[i] << " ";
  return 0;
}
