import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), idx, tmp; int[] t = new int[n]; for (int i = 0; i < n; i++) { t[i] = i + 1; } for (int i = 0; i < m; i++) { idx = sc.nextInt() - 1; tmp = t[idx]; for (int j = idx; j > 0; j--) { t[idx] = t[idx - 1]; } t[0] = tmp; } System.out.println(t[0]); } }