#include <bits/stdc++.h>
using namespace std;
int main() {
  int lights, pushed_buttons;
  cin >> lights >> pushed_buttons;
  int *buttons = new int[pushed_buttons];
  int *pulbs = new int[lights];
  for (int i = 0; i < lights; i++) {
    pulbs[i] = -1;
  }
  for (int i = 0; i < pushed_buttons; i++) {
    cin >> buttons[i];
    for (int l = buttons[i] - 1; l < lights; l++) {
      if (pulbs[l] == -1) {
        pulbs[l] = buttons[i];
      }
    }
  }
  for (int i = 0; i < lights; i++) {
    cout << pulbs[i] << " ";
  }
  return 0;
}
