mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N, Q = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) ok = [1] * (N+2) ok[0] = ok[-1] = 0 st = set() for i in range(Q-1, -1, -1): a, b = A[i], B[i] st_new = set() for v in st: flg = ok[v-1] | ok[v] | ok[v+1] if flg: ok[v] = 1 if ok[v-1] == 0 and v-1 != 0: st_new.add(v-1) if ok[v+1] == 0 and v+1 != N+1: st_new.add(v+1) st = st_new st.add(a) st.add(b) ok[a] = ok[b] = 0 if sum(ok) == 0: print("NO") else: print("YES") ans = [] for v in range(1, N+1): if ok[v]: ans.append(v) break t = 0 F = [0] * Q back = 0 while t < Q: a, b = A[t], B[t] v = ans[-1] if back == 0: t += 1 if v != a and v != b: if v != 1 and v != N: ans.append(v) elif v == 1: if a != 2 and b != 2: ans.append(2) else: ans.append(1) elif v == N: if a != N-1 and b != N-1: ans.append(N-1) else: ans.append(N) else: if v == 1: if a != 2 and b != 2: ans.append(2) else: back = 1 elif v == N: if a != N-1 and b != N-1: ans.append(N-1) else: back = 1 else: if v-1 != a and v-1 != b and v+1 != a and v+1 != b: if F[t] == 0: ans.append(v-1) F[t] = 1 else: ans.append(v+1) F[t] = 0 elif v-1 != a and v-1 != b: ans.append(v-1) elif v+1 != a and v+1 != b: ans.append(v+1) else: back = 1 else: ans.pop() t -= 1 if F[t] == 1: back = 0 print(*ans, sep="\n") if __name__ == '__main__': main()