#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans[105];
  int num[105];
  memset(ans, 0, sizeof(ans));
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &num[i]);
    for (int j = num[i]; j <= n; j++) {
      if (ans[j] == 0) ans[j] = num[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i == n)
      printf("%d\n", ans[i]);
    else
      printf("%d ", ans[i]);
  }
  return 0;
}
