#include <bits/stdc++.h>
using namespace std;
int A[126];
int n, m;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 1, k, j; i <= m; ++i) {
    cin >> k;
    for (j = k; j <= n; ++j)
      if (!A[j]) A[j] = k;
  }
  for (int i = 1; i <= n; ++i) cout << A[i] << " ";
  return 0;
}
