#include <bits/stdc++.h>
using namespace std;
int main() {
  int lampu1[101];
  int lampu[101];
  int n, m, a;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    lampu[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    cin >> a;
    for (int j = a; j <= n; j++) {
      if (lampu[j] == 0) {
        lampu[j] = 1;
        lampu1[j] = a;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << lampu1[i] << " ";
  }
}
