#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[101] = {}, x, n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &x);
    for (int j = x; j <= n; ++j)
      if (!arr[j]) arr[j] = x;
  }
  for (int i = 1; i <= n; ++i) printf("%d ", arr[i]);
}
