#include <bits/stdc++.h>
using namespace std;
int n, m;
int b[110], a[110];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
  }
  memset(a, -1, sizeof(a));
  for (int i = 1; i <= m; i++) {
    for (int j = b[i]; j <= n; j++) {
      if (a[j] != -1) break;
      a[j] = b[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i]);
  }
  return 0;
}
