#include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int i = 0; i < n; ++i) #define rep1(i,n) for(int i = 1; i <= n; ++i) using namespace std; templatebool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; } templatebool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; } template inline int sz(T &a) { return a.size(); } using ll = long long; using ld = long double; using pi = pair; using pl = pair; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; const int inf = numeric_limits::max(); const ll infll = numeric_limits::max(); //**************************************** // Graph template //**************************************** // status of edge template struct Edge{ int from; int to; X cost; Edge() = default; Edge(int from, int to, X cost) : from(from), to(to), cost(cost) {} }; // status of node template struct Node{ int idx; vector> edge; Node() = default; explicit Node(int idx) : idx(idx) {} }; template class Graph{ private: int n; // number of node int m; // number of edge vector> node; void Init_Node() { rep(i,n) node.emplace_back(i); } public: explicit Graph(int n) : n(n) { Init_Node(); } // edges have no-weight Graph(int n, int m, vector from, vector to) : n(n), m(m) { Init_Node(); rep(i,m) { add_edge(from[i], to[i]); // add_edge(to[i], from[i]); } } // edges have weight Graph(int n, int m, vector from, vector to, vector cost) : n(n), m(m) { Init_Node(); rep(i,m) { add_edge(from[i], to[i], cost[i]); add_edge(to[i], from[i], cost[i]); } } void add_edge(int from, int to, X cost = 1) { node[from].edge.emplace_back(from, to, cost); } // トポロジカルソートした頂点の配列を返す vector Tsort() { // 入次数のカウント vector in(n, 0); rep(i,n) { for(auto next: node[i].edge) { int w = next.to; in[w]++; } } queue q; // 頂点を入れるキュー rep(i,n) { if(in[i] == 0) q.push(i); } vector res; while( !q.empty() ) { int v = q.front(); q.pop(); res.push_back(v); for(auto next: node[v].edge) { int w = next.to; in[w]--; if(in[w] == 0) { q.push(w); } } } return res; } }; int main() { int n,m; cin >> n >> m; vi a(n); rep(i,n) { cin >> a[i]; a[i]--; } Graph gp(m); rep(i,n-1) { if(i&1) { gp.add_edge(a[i], a[i+1]); } else { gp.add_edge(a[i+1], a[i]); } if(i+2 < n) { if(a[i] == a[i+1] || a[i+1] == a[i+2] || a[i+2] == a[i]) { cout << "No" << "\n"; return 0; } } } vi res = gp.Tsort(); if(sz(res) == m) { cout << "Yes" << "\n"; for(auto tmp: res) cout << tmp+1 << " "; cout << "\n"; } else { cout << "No" << "\n"; } return 0; }