#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int n, m;
  cin >> n >> m;
  vector<int> b;
  for (int i = 0; i < m; i++) {
    int val;
    cin >> val;
    b.push_back(val);
  }
  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;
  return 0;
}
