#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
template <class T>
T jog(T a, T b) {
  return a + b;
}
template <class T>
T bog(T a, T b) {
  return a - b;
}
template <class T>
T gon(T a, T b) {
  return a * b;
}
template <class T>
T sq(T x) {
  return x * x;
}
template <class T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <class T>
T power(T a, T p) {
  int res = 1, x = a;
  while (p) {
    if (p & 1) res = res * x;
    x = x * x;
    p >>= 1;
  }
  return res;
}
template <class T>
T cordinatlenth(T a, T b, T c, T d) {
  return sqrt(sq(a - c) + sq(b - d));
}
long long bigmod(long long a, long long p, long long mod) {
  long long res = 1, x = a;
  while (p) {
    if (p & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    p >>= 1;
  }
  return res;
}
int diraction1[] = {-1, 0, 0, 1, 1, -1, -1, 1};
int diraction2[] = {0, -1, 1, 0, 1, -1, 1, -1};
int horsed1[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int horsed2[] = {1, -1, -2, -2, -1, 1, 2, 2};
void input();
int main() {
  input();
  return 0;
}
void input() {
  int ar[110], res[110], num, cou;
  scanf("%d %d", &num, &cou);
  bool mark[110];
  memset(mark, true, sizeof(mark));
  for (int i = 0; i < cou; i++) {
    scanf("%d", &ar[i]);
    mark[ar[i]] = false;
  }
  memset(res, -1, sizeof(res));
  for (int i = 0; i < cou; i++) {
    if (res[ar[i]] == -1) {
      int tmp = ar[i];
      res[tmp] = tmp;
      for (int j = tmp + 1; j <= num; j++)
        if (mark[j]) {
          mark[j] = false;
          res[j] = tmp;
        }
      for (int j = i + 1; j < cou; j++) {
        if (res[ar[j]] == -1) {
          if (ar[j] > tmp) res[ar[j]] = tmp;
        }
      }
    }
  }
  printf("%d", res[1]);
  for (int i = 2; i <= num; i++) printf(" %d", res[i]);
}
