#include <bits/stdc++.h>
using namespace std;
int a[50005], b[50005], c[50005];
int main() {
  int i, j, k, m, n;
  while (cin >> n >> m && n != 0 && m != 0) {
    for (i = 1; i <= n; i++) a[i] = i;
    for (i = 1; i <= m; i++) cin >> b[i];
    for (i = 1; i <= m; i++)
      for (j = 1; j <= n; j++) {
        if (a[j] >= b[i] && a[j] != 0) {
          a[j] = 0;
          c[j] = b[i];
        }
      }
    for (j = 1; j < n; j++) cout << c[j] << " ";
    cout << c[n] << endl;
  }
}
