#include <bits/stdc++.h>
using namespace std;
int arr[100];
multiset<int> myset;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    for (int j = t; j <= n; j++) {
      if (myset.count(j) == 0) arr[j] = t;
      myset.insert(j);
    }
  }
  for (int i = 1; i <= n; i++) cout << arr[i] << " ";
  cout << endl;
}
