#include <bits/stdc++.h>
using namespace std;
int a[105], b[105], ans[105];
int main() {
  int n, m, i, j, t;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (i = 1; i <= n; i++) {
      a[i] = 1;
    }
    for (i = 1; i <= m; i++) {
      cin >> b[i];
    }
    for (i = 1; i <= m; i++) {
      for (j = b[i]; j <= n; j++) {
        if (a[j] == 1) {
          ans[j] = b[i];
          a[j] = 0;
        }
      }
    }
    for (i = 1; i < n; i++) {
      cout << ans[i] << " ";
    }
    cout << ans[n] << endl;
  }
  return 0;
}
