#include <bits/stdc++.h>
using namespace std;
int main() {
  int light, cnt, num;
  while (cin >> light >> cnt) {
    int *p = new int[light];
    for (int i = 0; i < light; i++) p[i] = 0;
    for (int i = 0; i < cnt; i++) {
      cin >> num;
      for (int i = num; i <= light; i++)
        if (p[i - 1] == 0) p[i - 1] = num;
    }
    for (int i = 0; i < light; i++) {
      cout << p[i];
      if (light - i - 1) cout << " ";
    }
    delete[] p;
  }
}
