#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  int n, m;
  int brr[103];
  cin >> n >> m;
  int arr[103] = {0};
  for (int i = 1; i <= m; i++) {
    cin >> brr[i];
    for (int j = brr[i]; j <= n; j++)
      if (arr[j] == 0) arr[j] = brr[i];
  }
  for (int i = 1; i <= n; i++) cout << arr[i] << " ";
  return 0;
}
