#include <bits/stdc++.h>
using namespace std;
long long int n, k, cnt, ans, mn, mx, a, b, c, m;
string s, s1;
vector<int> v;
map<long long int, long long int> mp;
set<int> st;
long long int arr[107];
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> b;
    for (int j = b; j <= n; j++) {
      if (arr[j] != 0)
        break;
      else
        arr[j] = b;
    }
  }
  for (int i = 1; i <= n; i++) cout << arr[i] << " ";
  return 0;
}
