#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int m1[110], n1[110];
  for (int i = 0; i < m; i++) cin >> m1[i];
  memset(n1, 0, sizeof n1);
  for (int i = 0; i < m; i++) {
    for (int j = m1[i] - 1; j < n && n1[j] == 0; j++) {
      n1[j] = m1[i];
    }
  }
  for (int i = 0; i < n; i++) cout << n1[i] << " ";
  return 0;
}
