#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
void build(int *seg, int *a, int start, int end, int node)
{
if(start>end)
return;
if(start == end)
{
seg[node] = a[start];
return;
}
int mid = (start+end)>>1;
build (seg, a, start, mid, 2*node+1);
build (seg, a, mid+1, end, 2*node+2);
seg[node] = min(seg[2*node+1], seg[2*node+2]);
}
int query (int *seg, int l, int r, int start, int end, int node)
{
if(r<start || end<l || l>r)
return INT_MAX;
if(start>=l && end<=r)
{
return seg[node];
}
int mid = (start+end)>>1;
int q1 = query (seg, l, r, start, mid, 2*node+1);
int q2 = query (seg, l, r, mid+1, end, 2*node+2);
return min(q1,q2);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n=0, q=0;
cin>>n>>q;
int sz = n<<2;
int seg[sz]; int a[n];
fill(seg, seg + sz, INT_MAX);
for(int i=0; i<n; i++)
cin>>a[i];
vector < pair <int, int> > v(q+1); // derived range for each query {start, end}
//fill (v.begin(), v.end(), {-1,-1});
for(int i=0; i<=q; i++)
v[i].first = v[i].second = -1;
for(int i=0; i<n; i++)
{
if(v[a[i]].first == -1)
v[a[i]].first = i;
else
v[a[i]].second = i;
}
for(int i=0; i<=q; i++)
{
if(v[i].first !=-1 && v[i].second == -1)
v[i].second = v[i].first;
//cout<<i<<" "<<v[i].first<<" "<<v[i].second<<endl;
}
build(seg, a, 0, n-1, 0);
int flag = 0;
for(int i=q; i>=0; i--)
{
if(v[i].first !=-1 && v[i].second != -1)
{
//cout<<v[i].first<<" "<<v[i].second<<endl;
int qry = query(seg, v[i].first, v[i].second, 0, n-1, 0);
//cout<<qry<<endl;
if(i > qry && qry!=0)
{
cout<<"NO"<<endl; flag = 1; break;
}
}
}
if(flag == 0)
{
int z_flag =0;
for(int i=0; i<n; i++)
{
if(a[i]==0)
{
int l=-1, r=-1, j=i+1;
while(j<n)
{
if(a[j]!=0)
{
r = j; break;
}
else
++j;
}
j= i-1;
while(j>=0)
{
if(a[j]!=0)
{
l = j; break;
}
else
--j;
}
if( l==-1 && r==-1)
{
z_flag=1; break;
}
else if(r==-1)
{
for(j = l+1; j<n; j++)
a[j]=a[l];
break;
}
else if(l==-1)
{
for(j= r-1; j>=0; j--)
a[j] = a[r];
i = r;
}
else if( r!=-1 && l!=-1)
{
for(j = l+1; j<r; j++)
a[j]=a[r];
i=r;
}
}
}
//cout<<z_flag<<endl;
cout<<"YES"<<endl;
if(z_flag==1)
{
for(int i=0; i<n; i++)
cout<<q<<" ";
cout<<endl;
}
else
{
for(int i=0; i<n; i++)
cout<<a[i]<<" ";
cout<<endl;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGludCBsbDsKCnZvaWQgYnVpbGQoaW50ICpzZWcsIGludCAqYSwgaW50IHN0YXJ0LCBpbnQgZW5kLCBpbnQgbm9kZSkKewogICAgaWYoc3RhcnQ+ZW5kKQogICAgICAgIHJldHVybjsKICAgIGlmKHN0YXJ0ID09IGVuZCkKICAgIHsKICAgICAgICBzZWdbbm9kZV0gPSBhW3N0YXJ0XTsKICAgICAgICByZXR1cm47CiAgICB9CiAgICBpbnQgbWlkID0gKHN0YXJ0K2VuZCk+PjE7CiAgICBidWlsZCAoc2VnLCBhLCBzdGFydCwgbWlkLCAyKm5vZGUrMSk7CiAgICBidWlsZCAoc2VnLCBhLCBtaWQrMSwgZW5kLCAyKm5vZGUrMik7CiAgICAKICAgIHNlZ1tub2RlXSA9IG1pbihzZWdbMipub2RlKzFdLCBzZWdbMipub2RlKzJdKTsKfQoKaW50IHF1ZXJ5IChpbnQgKnNlZywgaW50IGwsIGludCByLCBpbnQgc3RhcnQsIGludCBlbmQsIGludCBub2RlKQp7CiAgICBpZihyPHN0YXJ0IHx8IGVuZDxsIHx8IGw+cikKICAgICAgICByZXR1cm4gSU5UX01BWDsKICAgIGlmKHN0YXJ0Pj1sICYmIGVuZDw9cikKICAgIHsKICAgICAgICByZXR1cm4gc2VnW25vZGVdOwogICAgfQogICAgaW50IG1pZCA9IChzdGFydCtlbmQpPj4xOwogICAgaW50IHExID0gcXVlcnkgKHNlZywgbCwgciwgc3RhcnQsIG1pZCwgMipub2RlKzEpOwogICAgaW50IHEyID0gcXVlcnkgKHNlZywgbCwgciwgbWlkKzEsIGVuZCwgMipub2RlKzIpOwogICAgCiAgICByZXR1cm4gbWluKHExLHEyKTsKfQoKaW50IG1haW4oKSAKewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKE5VTEwpOwogICAgCiAgICBpbnQgbj0wLCBxPTA7CiAgICBjaW4+Pm4+PnE7CiAgICAKICAgIGludCBzeiA9IG48PDI7CiAgICBpbnQgc2VnW3N6XTsgaW50IGFbbl07CiAgICBmaWxsKHNlZywgc2VnICsgc3osIElOVF9NQVgpOwogICAgCiAgICBmb3IoaW50IGk9MDsgaTxuOyBpKyspCiAgICAgICAgY2luPj5hW2ldOwogICAgdmVjdG9yIDwgcGFpciA8aW50LCBpbnQ+ID4gdihxKzEpOyAvLyBkZXJpdmVkIHJhbmdlIGZvciBlYWNoIHF1ZXJ5IHtzdGFydCwgZW5kfQogICAgLy9maWxsICh2LmJlZ2luKCksIHYuZW5kKCksIHstMSwtMX0pOwogICAgZm9yKGludCBpPTA7IGk8PXE7IGkrKykKICAgICAgICB2W2ldLmZpcnN0ID0gdltpXS5zZWNvbmQgPSAtMTsKICAgIAogICAgZm9yKGludCBpPTA7IGk8bjsgaSsrKQogICAgewogICAgICAgIGlmKHZbYVtpXV0uZmlyc3QgPT0gLTEpCiAgICAgICAgICAgIHZbYVtpXV0uZmlyc3QgPSBpOwogICAgICAgIGVsc2UKICAgICAgICAgICAgdlthW2ldXS5zZWNvbmQgPSBpOwogICAgfQogICAgCiAgICBmb3IoaW50IGk9MDsgaTw9cTsgaSsrKQogICAgewogICAgICAgIGlmKHZbaV0uZmlyc3QgIT0tMSAmJiB2W2ldLnNlY29uZCA9PSAtMSkKICAgICAgICAgICAgdltpXS5zZWNvbmQgPSB2W2ldLmZpcnN0OwogICAgICAgIC8vY291dDw8aTw8IiAiPDx2W2ldLmZpcnN0PDwiICI8PHZbaV0uc2Vjb25kPDxlbmRsOwogICAgfQogICAgCiAgICBidWlsZChzZWcsIGEsIDAsIG4tMSwgMCk7CiAgICAKICAgIGludCBmbGFnID0gMDsKICAgIGZvcihpbnQgaT1xOyBpPj0wOyBpLS0pCiAgICB7CiAgICAgICAgaWYodltpXS5maXJzdCAhPS0xICYmIHZbaV0uc2Vjb25kICE9IC0xKQogICAgICAgIHsKICAgICAgICAgICAgLy9jb3V0PDx2W2ldLmZpcnN0PDwiICI8PHZbaV0uc2Vjb25kPDxlbmRsOwogICAgICAgICAgICBpbnQgcXJ5ID0gcXVlcnkoc2VnLCB2W2ldLmZpcnN0LCB2W2ldLnNlY29uZCwgMCwgbi0xLCAwKTsKICAgICAgICAgICAgLy9jb3V0PDxxcnk8PGVuZGw7CiAgICAgICAgICAgIGlmKGkgPiBxcnkgJiYgcXJ5IT0wKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBjb3V0PDwiTk8iPDxlbmRsOyBmbGFnID0gMTsgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBpZihmbGFnID09IDApCiAgICB7CiAgICAgICAgaW50IHpfZmxhZyA9MDsKICAgICAgICBmb3IoaW50IGk9MDsgaTxuOyBpKyspCiAgICAgICAgewogICAgICAgICAgICBpZihhW2ldPT0wKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpbnQgbD0tMSwgcj0tMSwgaj1pKzE7CiAgICAgICAgICAgICAgICB3aGlsZShqPG4pCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWYoYVtqXSE9MCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBqOyBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICArK2o7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBqPSBpLTE7CiAgICAgICAgICAgICAgICB3aGlsZShqPj0wKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlmKGFbal0hPTApCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBsID0gajsgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgLS1qOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYoIGw9PS0xICYmIHI9PS0xKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHpfZmxhZz0xOyBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYocj09LTEpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZm9yKGogPSBsKzE7IGo8bjsgaisrKQogICAgICAgICAgICAgICAgICAgICAgICBhW2pdPWFbbF07CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKGw9PS0xKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGZvcihqPSByLTE7IGo+PTA7IGotLSkKICAgICAgICAgICAgICAgICAgICAgICAgYVtqXSA9IGFbcl07CiAgICAgICAgICAgICAgICAgICAgaSA9IHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKCByIT0tMSAmJiBsIT0tMSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBmb3IoaiA9IGwrMTsgajxyOyBqKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGFbal09YVtyXTsKICAgICAgICAgICAgICAgICAgICBpPXI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgLy9jb3V0PDx6X2ZsYWc8PGVuZGw7CiAgICAgICAgY291dDw8IllFUyI8PGVuZGw7CiAgICAgICAgaWYoel9mbGFnPT0xKQogICAgICAgIHsKICAgICAgICAgICAgZm9yKGludCBpPTA7IGk8bjsgaSsrKQogICAgICAgICAgICAgICAgY291dDw8cTw8IiAiOwogICAgICAgICAgICBjb3V0PDxlbmRsOwogICAgICAgIH0KICAgICAgICBlbHNlCiAgICAgICAgewogICAgICAgICAgICBmb3IoaW50IGk9MDsgaTxuOyBpKyspCiAgICAgICAgICAgICAgICBjb3V0PDxhW2ldPDwiICI7CiAgICAgICAgICAgIGNvdXQ8PGVuZGw7CiAgICAgICAgfQogICAgfQoJcmV0dXJuIDA7Cn0=