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