#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, check[101], button[101];
  cin >> n >> m;
  for (int i = 1; i <= n; i++) check[i] = 0;
  for (int i = 1; i <= m; i++) {
    cin >> button[i];
    for (int j = button[i]; j <= n; j++) {
      if (check[j] == 0) {
        check[j] = button[i];
      }
    }
  }
  sort(&check[1], &check[1] + n);
  for (int i = 1; i <= n; i++) {
    cout << check[i];
    if (i != n) cout << " ";
  }
  cout << endl;
  return 0;
}
