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