#include <bits/stdc++.h>
#include <atcoder/all>
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<pair<int,int>> dame[100005];

bool sfind(set<pair<int,int>>& s, int x){
  FOR(it,s){
    if(it->first <= x && x <= it->second) return true;
  }
  return false;
}


vector<int> solve(int N, const vector<pair<int,int>>& v){
  int Q = v.size();

  vector<int> ret;

  dame[Q-1].insert(make_pair(v[Q-1].first,v[Q-1].first));
  dame[Q-1].insert(make_pair(v[Q-1].second,v[Q-1].second));
  for(int i=Q-2; i>=0; i--){
    int a = v[i].first;
    int b = v[i].second;

    set<int> tmp;
    tmp.insert(a);
    tmp.insert(b);
    FOR(it,dame[i+1]){
      REP(j,-1,2){
        int pos = it->first + j;
        if(1<=pos && pos<=N){
          bool ok = false;
          REP(k,-1,2){
            int npos = pos + k;
            if(1<=npos && npos<=N && !sfind(dame[i+1], npos)){
              ok = true;
              break;
            }
          }
          if(!ok){
            tmp.insert(pos);
          }
        }
      }
      REP(j,-1,2){
        int pos = it->second + j;
        if(1<=pos && pos<=N){
          bool ok = false;
          REP(k,-1,2){
            int npos = pos + k;
            if(1<=npos && npos<=N && !sfind(dame[i+1], npos)){
              ok = true;
              break;
            }
          }
          if(!ok){
            tmp.insert(pos);
          }
        }
      }
    }

    int bgn = -1;
    int lst = -1;
    FOR(it,tmp){
      if(lst+1 == *it){
        lst++;
      }else{
        if(bgn > 0) dame[i].insert(make_pair(bgn,lst));
        bgn = *it;
        lst = *it;
      }
    }
    if(bgn > 0) dame[i].insert(make_pair(bgn,lst));
  }

  REP(i,1,N+1){
    if(!sfind(dame[0], i)){
      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 && !sfind(dame[j+1], npos)){
            nxt = npos;
            break;
          }
        }
        pos = nxt;
        ret.push_back(pos);
      }
      break;
    }
  }

  if(ret.size() > 0){
    rep(i,Q){
      int pos = ret[i];
      if(pos == v[i].first || pos == v[i].second) return vector<int>();
    }
  }
  
  return ret;
}


int main(){
  int N, Q;
  cin >> N >> Q;
  vector<pair<int,int>> v(Q);
  rep(i,Q) cin >> v[i].first;
  rep(i,Q) cin >> v[i].second;

  vector<int> 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;
}