#include <bits/stdc++.h>
using namespace std;
int saved[200];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int k;
    scanf("%d", &k);
    for (int i = k; i <= n; i++) {
      if (saved[i] == 0) {
        saved[i] = k;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", saved[i]);
  }
  cout << endl;
  return 0;
}
