#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<int> a;
  scanf("%d%d", &n, &m);
  int min = n + 2;
  for (int i = 0; i < m; i++) {
    int t;
    scanf("%d", &t);
    if (t < min) {
      a.push_back(t);
      min = t;
    }
    if (t == 1) break;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size() - 1; i++)
    for (int j = 0; j < a[i + 1] - a[i]; j++) printf("%d ", a[i]);
  for (int i = 0; i < n - a.back(); i++) printf("%d ", a.back());
  printf("%d\n", a.back());
}
