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