#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int b[m + 1];
  bool light[n + 1];
  for (int i = (int)(1); i < (int)(n + 1); i++) light[i] = true;
  for (int i = (int)(1); i < (int)(m + 1); i++) cin >> b[i];
  int res[n + 1];
  for (int i = (int)(1); i < (int)(m + 1); i++) {
    for (int j = (int)(b[i]); j < (int)(n + 1); j++) {
      if (light[j] == true) {
        light[j] = false;
        res[j] = b[i];
      }
    }
  }
  for (int i = (int)(1); i < (int)(n + 1); i++) cout << res[i] << " ";
}
