Initially there was an array $a$ consisting of $n$ integers. Positions in it are numbered from $1$ to $n$.

Exactly $q$ queries were performed on the array. During the $i$-th query some segment $(l_i, r_i)$ $(1 \le l_i \le r_i \le n)$ was selected and values of elements on positions from $l_i$ to $r_i$ inclusive got changed to $i$. The order of the queries couldn't be changed and all $q$ queries were applied. It is also known that every position from $1$ to $n$ got covered by at least one segment.

We could have offered you the problem about checking if some given array (consisting of $n$ integers with values from $1$ to $q$) can be obtained by the aforementioned queries. However, we decided that it will come too easy for you.

So the enhancement we introduced to it is the following. Some set of positions (possibly empty) in this array is selected and values of elements on these positions are set to $0$.

Your task is to check if this array can be obtained by the aforementioned queries. Also if it can be obtained then restore this array.

If there are multiple possible arrays then print any of them.


-----Input-----

The first line contains two integers $n$ and $q$ ($1 \le n, q \le 2 \cdot 10^5$) — the number of elements of the array and the number of queries perfomed on it.

The second line contains $n$ integer numbers $a_1, a_2, \dots, a_n$ ($0 \le a_i \le q$) — the resulting array. If element at some position $j$ is equal to $0$ then the value of element at this position can be any integer from $1$ to $q$.


-----Output-----

Print "YES" if the array $a$ can be obtained by performing $q$ queries. Segments $(l_i, r_i)$ $(1 \le l_i \le r_i \le n)$ are chosen separately for each query. Every position from $1$ to $n$ should be covered by at least one segment. 

Otherwise print "NO".

If some array can be obtained then print $n$ integers on the second line — the $i$-th number should be equal to the $i$-th element of the resulting array and should have value from $1$ to $q$. This array should be obtainable by performing exactly $q$ queries.

If there are multiple possible arrays then print any of them.


-----Examples-----
Input
4 3
1 0 2 3

Output
YES
1 2 2 3

Input
3 10
10 10 10

Output
YES
10 10 10 

Input
5 6
6 5 6 2 2

Output
NO

Input
3 5
0 0 0

Output
YES
5 4 2



-----Note-----

In the first example you can also replace $0$ with $1$ but not with $3$.

In the second example it doesn't really matter what segments to choose until query $10$ when the segment is $(1, 3)$.

The third example showcases the fact that the order of queries can't be changed, you can't firstly set $(1, 3)$ to $6$ and after that change $(2, 2)$ to $5$. The segment of $5$ should be applied before segment of $6$.

There is a lot of correct resulting arrays for the fourth example.

Difficulty: competition

Starter code:

Solutions:
import sys

n, k = map(int, input().split())
a = list(map(int, input().split()))

cur_max = 0
last_max = 1
last = dict()
zeros = []

for i in range(len(a))[::-1]:
    if a[i] == 0:
        zeros.append(i)
    elif a[i] not in last:
        last[a[i]] = i

stack = []

for i in range(len(a)):
    if a[i] == 0:
        a[i] = max(cur_max, 1)
    elif a[i] > cur_max and last[a[i]] != i:
        stack.append(cur_max)
        cur_max = a[i]
    elif cur_max != 0 and i == last[cur_max]:
        cur_max = stack.pop()
    elif a[i] < cur_max:
        print("NO")
        return

if k > max(a):
    if zeros:
        print("YES")
        a[zeros[0]] = k
        print(*a)
    else:
        print("NO")
elif k == max(a):
    print("YES")
    print(*a)
elif k < max(a):
    print("NO")

import sys
n,q = list(map(int,input().split()))
a = list(map(int,input().split()))
l = len(a)

zeros = []
last = dict()
cur_max = 0
last_max = 1

stack = []

for i in range(l-1,-1,-1):
    if a[i] == 0:
        zeros.append(i)
    elif a[i] not in last:
        last[a[i]] = i
for i in range(l):
    #print("********")
    #print(last)
    #print(a[i])
    if a[i] == 0:
        a[i] = max(cur_max,1)
    elif a[i] > cur_max and last[a[i]] != i: # 波峰
        stack.append(cur_max)
        cur_max = a[i]
    elif cur_max != 0 and i == last[cur_max]:
        cur_max = stack.pop()
    elif a[i] < cur_max: # 波谷
        print("NO")
        return
    #print(a[i])
    #print(cur_max)
    #print(stack)
    #print("--------")
#print("########")
#print(a)
#print(zeros)
if q > max(a):
    if zeros:
        print("YES")
        a[zeros[0]] = q
        print(*a)
    else:
        print("NO")
elif q == max(a):
    print("YES")
    print(*a)
elif q < max(a):
    print("NO")


import sys
n,q = map(int,input().split())
a = list(map(int,input().split()))
l = len(a)

zeros = []
last = dict()
cur_max = 0
last_max = 1

stack = []

for i in range(l-1,-1,-1):
    if a[i] == 0:
        zeros.append(i)
    elif a[i] not in last:
        last[a[i]] = i
for i in range(l):

    if a[i] == 0:
        a[i] = max(cur_max,1)
    elif a[i] > cur_max and last[a[i]] != i:
        stack.append(cur_max)
        cur_max = a[i]
    elif cur_max != 0 and i == last[cur_max]:
        cur_max = stack.pop()
    elif a[i] < cur_max: 
        print("NO")
        return

if q > max(a):
    if zeros:
        print("YES")
        a[zeros[0]] = q
        print(*a)
    else:
        print("NO")
elif q == max(a):
    print("YES")
    print(*a)
elif q < max(a):
    print("NO")

def getRawInteger():
    return [int(x) for x in input().split()]


n, q = getRawInteger()
a = getRawInteger()

if n != len(a):
    raise ValueError('n is not correct.')

l, r = [n] * (q + 5), [0] * (q + 5)
f = [i for i in range(n + 5)]


def getRoot(u):
    while f[u] != u:
        f[u] = f[f[u]]
        u = f[f[u]]
    return u


for i in range(n):
    l[a[i]] = min(l[a[i]], i)
    r[a[i]] = max(r[a[i]], i)
if l[q] > r[q]:
    if l[0] > r[0]:
        print('NO')
        return
    a[l[0]] = q
    f[l[0]] = getRoot(l[0] + 1)
for i in reversed(list(range(1, q + 1))):
    it = getRoot(l[i])
    while it <= r[i]:
        if a[it] < i and a[it]:
            print('NO')
            return
        a[it] = i
        f[it] = getRoot(it + 1)
        it = getRoot(it)
out = 'YES\n'
for x in a:
    if x:
        out += str(x) + ' '
    else:
        out += '1 '
print(out)