/** * @FileName a.cpp * @Author kanpurin * @Created 2021.01.29 22:23:35 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; struct DAG { private: struct Edge { int to; }; std::vector> graph; bool is_dag = false; std::vector sorted; int V; public: DAG(int v) { assert(v > 0); V = v; graph.resize(v); } void add_edge(int from, int to) { graph[from].push_back({to}); } std::vector topological_sort() { std::stack sta; std::vector in(V, 0); int used_cnt = 0; for (int i = 0; i < V; i++) { for (Edge e : graph[i]) { in[e.to]++; } } for (int i = 0; i < V; i++) if (in[i] == 0) { sta.push(i); used_cnt++; } while (!sta.empty()) { int p = sta.top(); sta.pop(); sorted.push_back(p); for (Edge e : graph[p]) { int v = e.to; in[v]--; if (in[v] == 0) { sta.push(v); used_cnt++; } } } if (used_cnt == V) { return sorted; } else { return std::vector(0); } } vector& operator[](int x) { return graph[x]; } }; bool kadomatsu(int a,int b,int c) { return a != c && ((a < b && b > c) || (a > b && b < c)); } int main() { int n,m;cin >> n >> m; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } DAG g(m); for (int i = 1; i < n; i++) { if (i % 2 == 1) { g.add_edge(a[i-1]-1,a[i]-1); } else { g.add_edge(a[i]-1,a[i-1]-1); } } auto p = g.topological_sort(); if (p.size() == 0) { puts("No"); } else { puts("Yes"); vector ans(m); for (int i = 0; i < p.size(); i++) { ans[p[i]] = i+1; } for (int i = 0; i < ans.size(); i++) { cout << ans[i] << " "; } cout << endl; } return 0; }