using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); static int[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, q) = (c[0], c[1]); var a = NMi; var b = NMi; var dp = Enumerable.Repeat(true, n).ToArray(); var cand = new List(); var moves = new List<(int from, int to)>[q]; for (var i = 0; i < moves.Length; ++i) moves[i] = new List<(int from, int to)>(); for (var i = 0; i < q; ++i) { var ncand = new List(); foreach (var ci in cand) { if (dp[ci] || a[i] == ci || b[i] == ci) continue; if (ci > 0 && dp[ci - 1]) { dp[ci] = true; moves[i].Add((ci - 1, ci)); ncand.Add(ci - 1); if (ci + 1 < n) ncand.Add(ci + 1); } else if (ci + 1 < n && dp[ci + 1]) { dp[ci] = true; moves[i].Add((ci + 1, ci)); ncand.Add(ci + 1); if (ci > 0) ncand.Add(ci - 1); } } if (dp[a[i]]) { dp[a[i]] = false; ncand.Add(a[i]); } if (dp[b[i]]) { dp[b[i]] = false; ncand.Add(b[i]); } cand = ncand; } if (dp.Any(f => f)) { WriteLine("YES"); var ans = new List(); var pos = 0; for (var i = 0; i < dp.Length; ++i) if (dp[i]) { pos = i; break; } ans.Add(pos); for (var i = q - 1; i >= 0; --i) { for (var j = 0; j < moves[i].Count; ++j) if (moves[i][j].to == pos) { pos = moves[i][j].from; break; } ans.Add(pos); } ans.Reverse(); WriteLine(string.Join("\n", ans.Select(ai => ai + 1))); } else { WriteLine("NO"); } } }