#include <bits/stdc++.h>
using namespace std;
int A[105];
int ans[105];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x;
    scanf("%d", &x);
    for (int j = x; j <= n; j++) {
      if (ans[j] == 0)
        ans[j] = x;
      else
        break;
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
