#include #include using namespace std; using namespace atcoder; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; //using mint = modint1000000007; //using mint = modint998244353; set dame[100005]; vector solve(int N, const vector>& v){ int Q = v.size(); vector ret; //vector> dame(Q); dame[Q-1].insert(v[Q-1].first); dame[Q-1].insert(v[Q-1].second); for(int i=Q-2; i>=0; i--){ int a = v[i].first; int b = v[i].second; dame[i].insert(a); dame[i].insert(b); FOR(it,dame[i+1]){ REP(j,-1,2){ int pos = *it + j; if(1<=pos && pos<=N){ bool ok = false; REP(k,-1,2){ int npos = pos + k; if(1<=npos && npos<=N && dame[i+1].find(npos) == dame[i+1].end()){ ok = true; break; } } if(!ok){ dame[i].insert(pos); } } } } } REP(i,1,N+1){ if(dame[0].find(i) == dame[0].end()){ int pos = i; ret.push_back(pos); rep(j,Q-1){ int nxt = pos; REP(k,-1,2){ int npos = pos + k; if(1<=npos && npos<=N && dame[j+1].find(npos) == dame[j+1].end()){ nxt = npos; break; } } pos = nxt; ret.push_back(pos); } break; } } return ret; } int main(){ int N, Q; cin >> N >> Q; vector> v(Q); rep(i,Q) cin >> v[i].first; rep(i,Q) cin >> v[i].second; vector ret = solve(N, v); if(ret.size() > 0){ cout << "YES" << endl; cout << ret[0] << endl; rep(i,ret.size()) cout << ret[i] << endl; return 0; } cout << "NO" << endl; return 0; }