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