import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Template { public static void main(String[] args) { List cardList = new ArrayList(); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); for(int i = 0; i < n; i++){ cardList.add(i + 1); } for(int i = 0; i < m; i++){ int a = sc.nextInt(); cardList.add(0, cardList.get(a - 1)); cardList.remove(a); } sc.close(); System.out.println(cardList.get(0)); } }