#include <bits/stdc++.h>
using namespace std;
int f[110], a[110], b[110], i, j, k, m, n, x, y, z;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    for (j = x; j <= n; j++)
      if (b[j] == 0) b[j] = x;
  }
  for (i = 1; i <= n; i++) printf("%d ", b[i]);
  printf("\n");
  return 0;
}
