import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.math.*; public class Main { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String[] str = br.readLine().split(" "); int n = Integer.parseInt(str[0]); int m = Integer.parseInt(str[1]); String[] str1 = br.readLine().split(" "); int[] deck = new int [n]; for(int i = 0; i < n; i++) deck[i] = i+1; for(int i = 0; i < m; i++){ int a = Integer.parseInt(str1[i]) -1; int tmp = deck[a]; for(int j = a; j > 0; j--){ deck[j] = deck[j-1]; } deck[0] = tmp; } sb.append(deck[0]); System.out.println(sb); } }