#include <bits/stdc++.h>
using namespace std;
long long readll() {
  bool minus = false;
  long long result = 0;
  char ch;
  ch = getchar();
  while (true) {
    if (ch == '-') break;
    if (ch >= '0' && ch <= '9') break;
    ch = getchar();
  }
  if (ch == '-')
    minus = true;
  else
    result = ch - '0';
  while (true) {
    ch = getchar();
    if (ch < '0' || ch > '9') break;
    result = result * 10 + (ch - '0');
  }
  if (minus)
    return -result;
  else
    return result;
}
int readint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MX = 4e5 + 100;
long long t[MX], d[MX];
int n, q;
bool mod[MX];
int h;
void calc(int p, long long k) {
  if (!mod[p])
    t[p] = t[p << 1] + t[p << 1 | 1];
  else
    t[p] = d[p] * k;
}
void apply(int p, long long value, long long k) {
  t[p] = value * k;
  if (p < n) {
    d[p] = value;
    mod[p] = true;
  }
}
void build(int l, int r) {
  long long k = 2;
  for (l += n, r += n - 1; l > 1; k <<= 1) {
    l >>= 1, r >>= 1;
    for (int i = r; i >= l; --i) calc(i, k);
  }
}
void push(int l, int r) {
  int s = h;
  long long k = 1 << (h - 1);
  for (l += n, r += n - 1; s > 0; --s, k >>= 1)
    for (int i = l >> s; i <= r >> s; ++i)
      if (mod[i]) {
        apply(i << 1, d[i], k);
        apply(i << 1 | 1, d[i], k);
        d[i] = 0;
        mod[i] = false;
      }
}
void modify(int l, int r, long long value) {
  push(l, l + 1);
  push(r - 1, r);
  int l0 = l, r0 = r, k = 1;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1, k <<= 1) {
    if (l & 1) apply(l++, value, k);
    if (r & 1) apply(--r, value, k);
  }
  build(l0, l0 + 1);
  build(r0 - 1, r0);
}
long long query(int l, int r) {
  push(l, l + 1);
  push(r - 1, r);
  long long res = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) res += t[l++];
    if (r & 1) res += t[--r];
  }
  return res;
}
struct Item {
  int start = -1, en = -1;
  int cnt = 0;
};
Item a[MX];
int ans[MX];
int vis[MX];
int arr[MX];
int nex[MX];
int getnex(int i) {
  if (arr[i] != 0) return arr[i];
  if (nex[i] != 0) return nex[i];
  nex[i] = getnex(i + 1);
  return nex[i];
}
int main() {
  memset(vis, 0, sizeof vis);
  memset(t, 0, sizeof t);
  memset(d, 0, sizeof d);
  int x, zcnt = 0, zin = -1;
  bool foundQ = false;
  scanf("%d%d", &n, &q);
  nex[n] = 1;
  h = sizeof(int) * 8 - __builtin_clz(n);
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    scanf("%d", &x);
    t[n + i] = 1LL * x;
    arr[i] = x;
    if (x == q) foundQ = true;
    if (x != 0) {
      if (a[x].start == -1) {
        a[x].start = i;
        a[x].en = i;
        a[x].cnt++;
      } else {
        a[x].en = i;
        a[x].cnt++;
      }
      build(i, i + 1);
    } else
      zcnt++, zin = i;
  }
  if (!foundQ) {
    if (zcnt == 0) {
      puts("NO");
      return 0;
    }
  }
  for (int(curr) = (int)(q); (curr) >= (int)(1); (curr)--) {
    if (a[curr].start != -1) {
      long long l = a[curr].start, r = a[curr].en;
      long long cnt = a[curr].cnt;
      long long len = r - l + 1;
      long long sum = query(l, r + 1);
      if (sum == cnt * curr) {
        modify(l, r + 1, 0LL);
      } else {
        puts("NO");
        return 0;
      }
    }
  }
  if (!foundQ) {
    arr[zin] = q;
    vis[zin] = true;
    foundQ = true;
  }
  puts("YES");
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    getnex(i);
    if (arr[i] != 0)
      printf("%d ", arr[i]);
    else
      printf("%d ", nex[i]);
  }
  return 0;
}
