#include <bits/stdc++.h>
int n, m, i, j, a[1001], b[1001];
int main() {
  scanf("%d %d", &n, &m);
  for (i = 1; i <= m; i++) scanf("%d", &a[i]);
  for (i = m; i >= 1; i--) {
    for (j = a[i]; j <= n; j++) b[j] = a[i];
  }
  for (i = 1; i <= n; i++) printf("%d ", b[i]);
  return 0;
}
