#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int a[n], b[m];
  for (long long int i = 0; i < m; i++) cin >> b[i];
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) a[i] = 1;
  long long int f = n;
  for (long long int i = 0; i < m; i++) {
    for (long long int j = b[i] - 1; j < n; j++) {
      if (a[j] == 1) {
        a[j] = 0;
        v.push_back(b[i]);
      }
    }
  }
  sort(v.begin(), v.end());
  for (auto it : v) cout << it << " ";
}
