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