#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, t, n, m, a[105], ans[105] = {0};
  cin >> n >> m;
  for (__typeof(0) i = 0; i <= m - 1; i++) cin >> a[i];
  for (__typeof(0) i = 0; i <= m - 1; i++) {
    int tem = a[i];
    for (int j = tem; j <= n; j++) {
      if (ans[j] == 0) ans[j] = a[i];
    }
  }
  for (__typeof(1) i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
