import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList list = new ArrayList<>(); for (int i = 1; i <= n; i++) { list.add(i); } int m = sc.nextInt(); for (int i = 0; i < m; i++) { int x = sc.nextInt() - 1; Integer target = list.remove(x); list.add(0, target); } System.out.println(list.get(0)); } }