#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s;
  int b[m], t = n;
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    while (t >= b[i]) {
      s.push_back(b[i]);
      t--;
    }
  }
  for (int i = s.size() - 1; i >= 0; i--) cout << s[i] << " ";
  return 0;
}
