using System; using System.Linq; using System.Collections.Generic; public class yukicoder { public static void Main() { int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); int[] shufflenum = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); List cards = new List(); for(int i = 0; i <= input[0] - 1; i++) { cards.Add(i + 1); } for(int i = 0; i <= input[1] - 1; i++) { int n = shufflenum[i] - 1; if(n != 0) { int temp = cards[n];; cards.Remove(temp); cards.Insert(0, temp); } } Console.WriteLine(cards[0]); } }