func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   T Abs(T first) {     return (first < 0 ? -first : first);   }   template <typename T>   T Sqr(T first) {     return (first * first);   }   string plural(string s) {     return (int((s).size()) && s[int((s).size()) - 1] ==  x  ? s +  en                                                               : s +  s );   }   const int INF = (int)1e9;   const long double EPS = 1e-12;   const long double PI = acos(-1.0);   bool Read(int &first) {     char c, r = 0, n = 0;     first = 0;     for (;;) {       c = getchar();       if ((c < 0) && (!r)) return (0);       if ((c ==  - ) && (!r))         n = 1;       else if ((c >=  0 ) && (c <=  9 ))         first = first * 10 + c -  0 , r = 1;       else if (r)         break;     }     if (n) first = -first;     return (1);   }   bool ReadLL(long long &first) {     char c, r = 0, n = 0;     first = 0;     for (;;) {       c = getchar();       if ((c < 0) && (!r)) return (0);       if ((c ==  - ) && (!r))         n = 1;       else if ((c >=  0 ) && (c <=  9 ))         first = first * 10 + c -  0 , r = 1;       else if (r)         break;     }     if (n) first = -first;     return (1);   }   long long A[200005], X[200005], B[200005];   int C[200005];   int ord[200005], cor[200005];   int main() {     if (0) freopen( in.txt ,  r , stdin);     int N, M;     long long K;     int i, j, k, a, b, c, first, second, z, m;     long long v;     Read(N), ReadLL(K);     for (i = 0; i < N; i++) ReadLL(A[i]);     memset(C, 0, sizeof(C));     for (i = 0; i < N; i++) {       ReadLL(X[i]), X[i]--;       C[X[i]]++;     }     for (i = 0; i < N; i++)       if (i && X[i] < X[i - 1]) goto Imp;     if (X[N - 1] != N - 1) goto Imp;     j = k = 0;     for (i = 0; i < N; i++) {       k += C[i];       if (k > i + 1) goto Imp;       if (k == i + 1) {         for (a = j; a <= i; a++)           if (X[a] != i) goto Imp;         if (j && B[j - 1] >= A[j] + K) goto Imp;         for (a = j; a <= i - 1; a++) B[a] = A[a + 1] + K;         if (i == j)           B[i] = A[i] + K;         else           B[i] = B[i - 1] + 1;         j = i + 1;       }     }     if (0) {       memset(cor, -1, sizeof(cor));       for (i = 0; i < N; i++) ord[i] = i;       do {         for (i = 0; i < N; i++)           if (B[ord[i]] < A[i] + K) goto Bad;         for (i = 0; i < N; i++) cor[i] = max(cor[i], ord[i]);       Bad:;       } while (next_permutation(ord, ord + N));       for (i = 0; i < N; i++)         if (X[i] != cor[i]) break;       if (i == N) {       } else {         printf( WRONG n );       }     }     printf( Yes n );     for (i = 0; i < N; i++) {       if (i) printf(   );       cout << B[i];     }     printf(  n );     return (0);   Imp:;     printf( No n );     return (0);   }   