#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, tmp;
  cin >> n >> m;
  vector<int> v(n, 0);
  while (m--) {
    cin >> tmp;
    if (v[tmp - 1] == 0) {
      for (int i = tmp - 1; i < n; i++) {
        if (v[i]) break;
        v[i] = tmp;
      }
    }
  }
  for (auto i : v) cout << i << " ";
}
