#include <bits/stdc++.h>
using namespace std;
const int MAX = 200;
int num[MAX], vis[MAX];
int main() {
  int n, m, a;
  while (scanf("%d %d", &n, &m) == 2) {
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < m; i++) {
      scanf("%d", &a);
      for (int i = a; i <= n; i++)
        if (!vis[i]) {
          num[i] = a;
          vis[i] = 1;
        }
    }
    for (int i = 1; i <= n; i++) {
      if (i == 1)
        printf("%d", num[i]);
      else
        printf(" %d", num[i]);
    }
    printf("\n");
  }
  return 0;
}
