#include <bits/stdc++.h>
using namespace std;
int ans[105], d, n, m;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < (m); i++) {
    scanf("%d", &d);
    for (int p = d; p <= n; p++) {
      if (!ans[p]) ans[p] = d;
    }
  }
  for (int i = 1; i < n; i++) printf("%d ", ans[i]);
  printf("%d\n", ans[n]);
  return 0;
}
