#include <bits/stdc++.h>
using namespace std;
int dp[20005][105], n, *a;
int solve(int v, int i) {
  if (i == n) {
    if (v == 0) return 1;
    return 0;
  }
  if (v < 0) return INT_MIN;
  if (v == 0) return true;
  if (dp[v][i] != -5) return dp[v][i];
  return dp[v][i] = max(solve(v - a[i], i + 1), solve(v, i + 1));
}
int main() {
  int k;
  scanf("%d%d", &n, &k);
  vector<pair<int, int>> x(n + 5);
  bool *visited = new bool[n + 5];
  for (int i = 1; i <= n; i++) {
    visited[i] = false;
    x[i] = make_pair(i + 1, 0);
  }
  a = new int[k];
  for (int i = 0; i < k; i++) {
    scanf("%d", &a[i]);
    for (int j = a[i]; j <= n; j++) {
      if (!visited[j]) x[j].second = a[i], visited[j] = true;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", x[i].second);
  return 0;
}
