mod = 1000000007 eps = 10**-9 def main(): import sys import random 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() snapshot = [None] * Q 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 i % 500 == 0 and i != 0: snapshot[i] = ok[:] if sum(ok) == 0: print("NO") else: print("YES") ans = [] v0 = [] for v in range(1, N+1): if ok[v]: v0.append(v) v = v0[len(v0) // 2] ans.append(v) t = 0 while True: t0 = t if len(ans) == Q+1: break ok_flg = 1 for _ in range(500): if len(ans) == Q + 1: break a, b = A[t], B[t] R = random.sample(range(3), k=3) flg = 0 for r in R: u = v + r - 1 if u != a and u != b and u != 0 and u != N+1: flg = 1 ans.append(u) v = u break if not flg: ok_flg = 0 break t += 1 if len(ans) == Q+1: break if not ok_flg: while len(ans) > t0 + 1: ans.pop() else: if snapshot[t0 // 500 + 1][v] == 0: while len(ans) > t0 + 1: ans.pop() print(*ans, sep="\n") if __name__ == '__main__': main()