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