#include <bits/stdc++.h>
using namespace std;
void fast();
int main() {
  fast();
  int n, m;
  cin >> n >> m;
  int buttons[105] = {0}, lights[105] = {0};
  for (int i = 1; i <= m; ++i) cin >> buttons[i];
  for (int i = 1; i <= m; ++i) {
    int temp = buttons[i];
    for (int j = temp; j <= n; ++j) {
      if (!lights[j])
        lights[j] = temp;
      else
        break;
    }
  }
  for (int i = 1; i <= n; ++i) cout << lights[i] << ' ';
  return 0;
}
void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
