import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int[] A = new int[M]; for(int i = 0; i < M; i++) { A[i] = sc.nextInt()-1; } int[] now = new int[N]; for(int i = 0; i < N; i++) { now[i] = i+1; } for(int i = 0; i < M; i++) { int tmp = now[A[i]]; for(int j = A[i]; j >= 1; j--) { now[j] = now[j-1]; } now[0] = tmp; } System.out.println(now[0]); } }