import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }
        

        System.out.println(z);
    }
} import java.util.*; util.* java import java.math.BigDecimal; BigDecimal java.math public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }
        

        System.out.println(z);
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }
        

        System.out.println(z);
    } main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }
        

        System.out.println(z);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int check = n; check n int z= 999; z 999 int p[] = new int[n]; p new int[n] n int ans = 100; ans 100 HashSet hs = new HashSet(); hs new HashSet() for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          hs.add(sc.nextInt());
        } {
          hs.add(sc.nextInt());
        } hs.add(sc.nextInt()) hs.add hs sc.nextInt() sc.nextInt sc hs.add(x) hs.add hs x if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        } hs.size() != n hs.size() hs.size hs n {
          System.out.println(x);
          System.exit(0);
        } System.out.println(x) System.out.println System.out System System.out x System.exit(0) System.exit System 0 for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        } int i = -100; int i = -100; i -100 100 i <= 200 i 200 i++ i++ i {
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        } {
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        } hs.add(i) hs.add hs i if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          } hs.size() != check hs.size() hs.size hs check {
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          } if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            } Math.abs(x - i) < ans Math.abs(x - i) Math.abs Math x - i x i ans {
              ans = x - i;
              z = i;
            } ans = x - i ans x - i x i z = i z i check++ check System.out.println(z) System.out.println System.out System System.out z String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }
        

        System.out.println(z);
    }
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }
        

        System.out.println(z);
    }
} Main
import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
        int n = sc.nextInt();
        int check = n;
        int z= 999;
        int p[] = new int[n];
        int ans = 100;
        HashSet hs = new HashSet();
        for(int i = 0; i < n;i++){
          hs.add(sc.nextInt());
        }
        
        hs.add(x);
        if(hs.size() != n){
          System.out.println(x);
          System.exit(0);
        }
        for(int i = -100; i <= 200;i++){
          hs.add(i);
          if(hs.size() != check){
            if(Math.abs(x - i) < ans){
              ans = x - i;
              z = i;
            }
            check++;
          }
        }
        

        System.out.println(z);
    }
}