#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, b[1000] = {0};
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x;
    for (int j = x - 1; j < n; j++) {
      if (b[j] == 0) {
        b[j] = x;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << b[i] << ' ';
  return 0;
}
