#agc059d. [agc059_d]Distinct Elements on Subsegments

[agc059_d]Distinct Elements on Subsegments

Problem Statement

For an integer array A=(A1,A2,ldots,AN+K1)A=(A_1, A_2, \\ldots, A_{N + K-1}) (1leqAileqN+K11 \\leq A_i \\leq N+K-1), let's construct an array B=(B1,B2,ldots,BN)B=(B_1, B_2, \\ldots, B_N), where BiB_i is the number of distinct elements in Ai,Ai+1,ldots,Ai+K1A_i,A_{i+1},\\ldots,A_{i+K-1}.

You are given B1,B2,ldots,BNB_1, B_2, \\ldots, B_N. Determine if there exists an array AA which could have produced such an array BB, and if yes, construct one.

Solve TT test cases for each input file.

Constraints

  • 1leTle5cdot1041 \\le T \\le 5 \\cdot 10^4
  • 2leNle2cdot1052 \\le N \\le 2 \\cdot 10^5
  • 2leKle2cdot1052 \\le K \\le 2 \\cdot 10^5
  • 1leBileK1 \\le B_i \\le K
  • The sum of NN in one input file doesn't exceed 2cdot1052\\cdot 10^5.
  • The sum of KK in one input file doesn't exceed 2cdot1052\\cdot 10^5.
  • All values in the input are integers.

Input

Input is given from Standard Input in the following format:

TT case1case_1 case2case_2 vdots\\vdots caseTcase_T

Each case is in the following format:

NN KK B1B_1 B2B_2 ldots\\ldots BNB_N

Output

For each test case, if such an array AA doesn't exist, output NO.

Otherwise, output the answer in the following format:

YES A1A_1 A2A_2 ldots\\ldots AN+K1A_{N+K-1}

Here, 1leqAileqN+K11 \\leq A_i \\leq N+K-1 must hold, and AA should produce BB. If multiple solutions exist, any of them will be accepted.

In printing YES or NO, you can output each letter in any case (upper or lower).


Sample Input 1

3
3 3
1 2 1
4 3
1 2 2 1
6 4
3 3 3 3 3 3

Sample Output 1

NO
YES
1 1 1 2 2 2 
YES
1 2 3 1 2 3 1 2 3