#include <bits/stdc++.h>
using namespace std;
int mem[101];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0, a; i < m; i++) {
    cin >> a;
    for (int j = a; j <= n; j++)
      if (!mem[j])
        mem[j] = a;
      else
        break;
  }
  for (int i = 1; i <= n; i++) cout << mem[i] << " ";
}
