#include <bits/stdc++.h>
using namespace std;
int b[101];
bool c[101];
int main() {
  int n, m, x;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    for (int j = x; j <= n; j++) {
      if (!c[j]) {
        b[j] = x;
        c[j] = 1;
      } else {
        break;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
}
