#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main() {
  int n, m;
  cin >> n >> m;
  int btns[m + 1];
  for (int i = 1; i <= m; i++) cin >> btns[i];
  for (int i = 1; i <= m; i++) {
    for (int j = btns[i], k = btns[i]; j <= n; j++) {
      if (mp[j] == 0) mp[j] = k;
    }
  }
  for (auto m : mp) cout << m.second << " ";
  return 0;
}
