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