import java.util.*; public class card{ public static void main(String... args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int[] number = new int[n]; for(int i = 0; i < n; i++){ number[i] = i+1; } System.out.println(cardShuffle(number,m,scan)); } public static int cardShuffle(int[] number,int m,Scanner scan){ for(int i = 0; i < m; i++){ int shuffle_number = scan.nextInt(); int now = number[shuffle_number-1]; for(int j = shuffle_number-1; 0 < j; j--){ number[j] = number[j-1]; } number[0] = now; } return number[0]; } }