""" 大小大小大 M頂点のグラフを考える ><><>< みたいな感じで割り当てる 後はトポロジカルソート """ from sys import stdin import sys from collections import deque def kd(L): if L[0]==L[1] or L[1]==L[2] or L[2]==L[0]: return False elif max(L) == L[1] or min(L) == L[1]: return True else: return False def kdl(L): for i in range(len(L)-2): if not kd(L[i:i+3]): return False return True N,M = map(int,stdin.readline().split()) a = list(map(int,stdin.readline().split())) if M < 3: print ("No") sys.exit() lis = [ [] for i in range(M)] Inum = [0] * M for i in range(N-1): if i % 2 == 0: v,u = a[i]-1,a[i+1]-1 else: u,v = a[i]-1,a[i+1]-1 if u == v: print ("No") sys.exit() lis[v].append(u) Inum[u] += 1 use = 1 d = [1] * M q = deque([]) for i in range(M): if Inum[i] == 0: q.append(i) end = 0 while q: v = q.popleft() d[v] = use use += 1 end += 1 for nex in lis[v]: Inum[nex] -= 1 if Inum[nex] == 0: q.append(nex) if end != M: print ("No") else: print ("Yes") print (*d)