func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void splay(int &v) {     v = 0;     char c = 0;     int p = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) p = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       v = (v << 3) + (v << 1) + c -  0 ;       c = getchar();     }     v *= p;   }   const int N = 800010;   int v[N], a[N], n, m, mi;   vector<int> vv[N];   void build(int l, int r, int w) {     if (l == r) return v[w] = a[l], void();     int mid = l + r >> 1;     build(l, mid, w << 1);     build(mid + 1, r, w << 1 | 1);     v[w] = min(v[w << 1], v[w << 1 | 1]);   }   void get(int l, int r, int w, int L, int R) {     if (L <= l && r <= R) {       mi = min(mi, v[w]);       return;     }     int mid = l + r >> 1;     if (L <= mid) get(l, mid, w << 1, L, R);     if (R > mid) get(mid + 1, r, w << 1 | 1, L, R);   }   int getmi(int l, int r) {     mi = 1 << 30;     if (l > r) return mi;     get(1, n, 1, l, r);     return mi;   }   int now = -1;   int main() {     splay(n), splay(m);     a[0] = 1;     for (int i = 1; i <= n; i++) {       splay(a[i]);       if (!a[i]) {         a[i] = a[i - 1];         now = i;       }       vv[a[i]].push_back(i);     }     build(1, n, 1);     for (int i = 1; i <= m; i++) {       for (int j = 0; j < (int)(vv[i].size()) - 1; j++) {         int x = getmi(vv[i][j] + 1, vv[i][j + 1] - 1);         if (x < i) puts( NO ), exit(0);       }     }     bool flag = 0;     for (int i = 1; i <= n; i++) {       if (a[i] == m) flag = 1;     }     if (!flag) {       if (now != -1)         a[now] = m;       else         puts( NO ), exit(0);     }     puts( YES );     for (int i = 1; i <= n; i++) {       printf( %d%c , a[i],    n [i == n]);     }   }   