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