#include <bits/stdc++.h>
using namespace std;
void My() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
}
int main() {
  My();
  long long num, m, x, out[111] = {}, i, j, a;
  bool on[111];
  for (i = 0; i < 111; i++) {
    on[i] = 1;
  }
  cin >> num >> m;
  for (i = 0; i < m; i++) {
    a = 0;
    cin >> x;
    if (on[x - 1]) {
      out[x - 1] = x;
      on[x - 1] = 0;
    }
    for (j = x; j < num; j++) {
      if (on[j]) out[j] = x;
      on[j] = 0;
    }
    for (j = 0; j < num; j++) {
      if (on[j] == 0) a++;
    }
    if (a == num) break;
  }
  for (int i = 0; i < num; i++) {
    cout << out[i];
    if (i + 1 < num) cout << " ";
  }
  cout << endl;
  return 0;
}
