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