import java.io.*; import java.util.*; import java.math.*; class Main { public static void out (Object o) { System.out.println(o); } public static int[] init (int n) { int[] ret = new int[n]; for (int i = 0; i < n; i++) { ret[i] = i + 1; } return ret; } public static int[] shuffle (int[] nums , int s) { int tmp = nums[s]; for (int i = s; i > 0; i--) { nums[i] = nums[i - 1]; } nums[0] = tmp; return nums; } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line1 = br.readLine().split(" "); String[] line2 = br.readLine().split(" "); int n = Integer.parseInt(line1[0]); int m = Integer.parseInt(line1[1]); int[] nums = init(n); //out(Arrays.toString(nums)); for (int i = 0; i < m; i++) { int s = Integer.parseInt(line2[i]); nums = shuffle(nums , s - 1); //out(Arrays.toString(nums)); } out(nums[0]); } }