#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, temp, temp2 = 0;
  cin >> n >> m;
  vector<bool> log(n, true);
  vector<int> num(n);
  for (int i = 0; i < m; i++) {
    cin >> temp;
    for (int j = 0; temp + j <= n; j++) {
      if (log[temp + j - 1] == 1) {
        num[temp + j - 1] = temp;
        log[temp + j - 1] = 0;
        temp2++;
      }
    }
    temp2 = 0;
  }
  cout << num[0];
  for (int i = 1; i < n; i++) {
    cout << " " << num[i];
  }
  cout << endl;
  return 0;
}
