#include <bits/stdc++.h>   using namespace std;   #pragma optimize( O3 )   const int N = 200005;   int arr[N];   int fst[1000000], lst[1000000];   int minVal(int x, int y) { return (x < y) ? x : y; }   int getMid(int s, int e) { return s + (e - s) / 2; }   int RMQUtil(int *st, int ss, int se, int qs, int qe, int index) {     if (qs <= ss && qe >= se) return st[index];     if (se < qs || ss > qe) return INT_MAX;     int mid = getMid(ss, se);     return minVal(RMQUtil(st, ss, mid, qs, qe, 2 * index + 1),                   RMQUtil(st, mid + 1, se, qs, qe, 2 * index + 2));   }   int RMQ(int *st, int n, int qs, int qe) {     if (qs < 0 || qe > n - 1 || qs > qe) {       printf( Invalid Input );       return -1;     }     return RMQUtil(st, 0, n - 1, qs, qe, 0);   }   int constructSTUtil(int arr[], int ss, int se, int *st, int si) {     if (ss == se) {       st[si] = arr[ss];       return arr[ss];     }     int mid = getMid(ss, se);     st[si] = minVal(constructSTUtil(arr, ss, mid, st, si * 2 + 1),                     constructSTUtil(arr, mid + 1, se, st, si * 2 + 2));     return st[si];   }   int *constructST(int arr[], int n) {     int x = (int)(ceil(log2(n)));     int max_size = 2 * (int)pow(2, x) - 1;     int *st = new int[max_size];     constructSTUtil(arr, 0, n - 1, st, 0);     return st;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, q;     cin >> n >> q;     for (int i = 1; i <= q; i++) fst[i] = lst[i] = -1;     for (int i = 0; i < n; i++) {       cin >> arr[i];       fst[arr[i]] = (fst[arr[i]] == -1 ? i : fst[arr[i]]);       lst[arr[i]] = i;       if (arr[i] == 0) arr[i] = INT_MAX;     }     int *st = constructST(arr, n);     for (int i = 1; i <= q; i++) {       if (fst[i] == -1) continue;       int a = RMQ(st, n, fst[i], lst[i]);       if (a < i) {         cout <<  NO  << (  n );         return 0;       }     }     if (lst[q] == -1) {       bool b = false;       for (int i = 0; i < n; i++) {         if (arr[i] == INT_MAX) {           b = true, arr[i] = q;           break;         }       }       if (!b) {         cout <<  NO  << (  n );         return 0;       }     }     vector<int> pos;     for (int i = 0; i < n; i++)       if (arr[i] != INT_MAX) pos.push_back(i);     for (auto i : pos) {       int s = i - 1, e = i + 1;       bool poss = true;       while (poss) {         if (s >= 0 && arr[s] != INT_MAX) s = -1;         if (e < n && arr[e] != INT_MAX) e = n;         if (s >= 0) arr[s] = arr[i];         if (e < n) arr[e] = arr[i];         s--;         e++;         if (s < 0 && e >= n) poss = false;       }     }     cout <<  YES  << (  n );     for (int i = 0; i < n; i++) cout << arr[i] <<    ;     cout << (  n );   }   