#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[100], arr2[100], arr3[100], n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) arr3[i] = i + 1;
  int count, x = 0;
  for (int i = 0; i < m; i++) {
    count = 0;
    for (int j = arr[i] - 1; j < n; j++) {
      if (arr3[j] >= arr[i]) {
        count++;
        arr3[j] = 0;
      }
    }
    for (int c = count; c > 0; c--) {
      arr2[x] = arr[i];
      x++;
    }
  }
  sort(arr2, arr2 + n);
  for (int i = 0; i < n; i++) cout << arr2[i] << " ";
  cout << endl;
}
