import java.util.*; public class Exercise94{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] cards = new int[n]; for(int i = 0; i < n; i++){ cards[i] = i + 1; } int m = sc.nextInt(); for(int i = 0; i < m; i++){ int x = sc.nextInt() - 1; int y = cards[x]; for(int j = x - 1; j >= 0; j--){ cards[j + 1] = cards[j]; } cards[0] = y; } System.out.println(cards[0]); } }