#include <bits/stdc++.h>
using namespace std;
bool csort(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second < b.second;
}
int ar[102];
int main() {
  int m, n, ind, i, c;
  scanf("%d%d", &m, &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &ind);
    for (c = ind; c <= m; c++) {
      if (ar[c] == 0) ar[c] = ind;
    }
  }
  for (i = 1; i <= m; i++) {
    printf("%d ", ar[i]);
  }
  return 0;
}
