using System; using System.Linq; class Program { static void Main() { var tmp = Console.ReadLine().Split(); int n = int.Parse(tmp[0]); int m = int.Parse(tmp[1]); var a = Console.ReadLine().Split().Select(int.Parse).ToArray(); var num = new int[n]; for (int i = 0; i < n; i++) num[i] = i + 1; for (int i = 0; i < m; i++) { int tm = num[a[i] - 1]; for (int j = a[i] - 1; j > 0; j--) { num[j] = num[j - 1]; } num[0] = tm; Console.WriteLine(num[0]+" "+num[1]+" " + num[2]+ " " + num[3]+ " " + num[4]); } Console.WriteLine(num[0]); } }