import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int N = sc.nextInt();
      	int res = 0;

       if(N == 0){
         System.out.println(x); 
         return;
       }
      
      	//set
        Set<Integer> s = new HashSet<Integer>();     
        for (int i=0; i<N; i++) {
            int p = sc.nextInt();
          s.add(p);
        }        
      	//while x 0
      	int t = x;
      	int resA = 0;
      	while(t > 0){
          if(!s.contains(t)){
            resA = t;
            break;
          }
          t--;
        }
      
      	//while x 100
        int k = x;
        int resB = 101;
      	while(k <= 100){
          if(!s.contains(k)){
            resB = k;
            break;
          }
          k++;
        }

      	if(Math.abs(resA) == Math.abs(resB)){
		  if(resA > resB){
            res = resB;
          }else { res = resA;}
        }
      	else if(Math.abs(x - resA) > Math.abs(x - resB)){
          res = resB;
        }else{
          res = resA;
        }
        //System.out.println(resA+" "+resB);

        System.out.println(res);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int N = sc.nextInt();
      	int res = 0;

       if(N == 0){
         System.out.println(x); 
         return;
       }
      
      	//set
        Set<Integer> s = new HashSet<Integer>();     
        for (int i=0; i<N; i++) {
            int p = sc.nextInt();
          s.add(p);
        }        
      	//while x 0
      	int t = x;
      	int resA = 0;
      	while(t > 0){
          if(!s.contains(t)){
            resA = t;
            break;
          }
          t--;
        }
      
      	//while x 100
        int k = x;
        int resB = 101;
      	while(k <= 100){
          if(!s.contains(k)){
            resB = k;
            break;
          }
          k++;
        }

      	if(Math.abs(resA) == Math.abs(resB)){
		  if(resA > resB){
            res = resB;
          }else { res = resA;}
        }
      	else if(Math.abs(x - resA) > Math.abs(x - resB)){
          res = resB;
        }else{
          res = resA;
        }
        //System.out.println(resA+" "+resB);

        System.out.println(res);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int N = sc.nextInt();
      	int res = 0;

       if(N == 0){
         System.out.println(x); 
         return;
       }
      
      	//set
        Set<Integer> s = new HashSet<Integer>();     
        for (int i=0; i<N; i++) {
            int p = sc.nextInt();
          s.add(p);
        }        
      	//while x 0
      	int t = x;
      	int resA = 0;
      	while(t > 0){
          if(!s.contains(t)){
            resA = t;
            break;
          }
          t--;
        }
      
      	//while x 100
        int k = x;
        int resB = 101;
      	while(k <= 100){
          if(!s.contains(k)){
            resB = k;
            break;
          }
          k++;
        }

      	if(Math.abs(resA) == Math.abs(resB)){
		  if(resA > resB){
            res = resB;
          }else { res = resA;}
        }
      	else if(Math.abs(x - resA) > Math.abs(x - resB)){
          res = resB;
        }else{
          res = resA;
        }
        //System.out.println(resA+" "+resB);

        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int N = sc.nextInt();
      	int res = 0;

       if(N == 0){
         System.out.println(x); 
         return;
       }
      
      	//set
        Set<Integer> s = new HashSet<Integer>();     
        for (int i=0; i<N; i++) {
            int p = sc.nextInt();
          s.add(p);
        }        
      	//while x 0
      	int t = x;
      	int resA = 0;
      	while(t > 0){
          if(!s.contains(t)){
            resA = t;
            break;
          }
          t--;
        }
      
      	//while x 100
        int k = x;
        int resB = 101;
      	while(k <= 100){
          if(!s.contains(k)){
            resB = k;
            break;
          }
          k++;
        }

      	if(Math.abs(resA) == Math.abs(resB)){
		  if(resA > resB){
            res = resB;
          }else { res = resA;}
        }
      	else if(Math.abs(x - resA) > Math.abs(x - resB)){
          res = resB;
        }else{
          res = resA;
        }
        //System.out.println(resA+" "+resB);

        System.out.println(res);
    } 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 res = 0; res 0 if(N == 0){
         System.out.println(x); 
         return;
       } N == 0 N 0 {
         System.out.println(x); 
         return;
       } System.out.println(x) System.out.println System.out System System.out x return; Set<Integer> s = new HashSet<Integer>(); s new HashSet<Integer>() for (int i=0; i<N; i++) {
            int p = sc.nextInt();
          s.add(p);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int p = sc.nextInt();
          s.add(p);
        } {
            int p = sc.nextInt();
          s.add(p);
        } int p = sc.nextInt(); p sc.nextInt() sc.nextInt sc s.add(p) s.add s p int t = x; t x int resA = 0; resA 0 while(t > 0){
          if(!s.contains(t)){
            resA = t;
            break;
          }
          t--;
        } t > 0 t 0 {
          if(!s.contains(t)){
            resA = t;
            break;
          }
          t--;
        } if(!s.contains(t)){
            resA = t;
            break;
          } !s.contains(t) s.contains(t) s.contains s t {
            resA = t;
            break;
          } resA = t resA t break; t-- t int k = x; k x int resB = 101; resB 101 while(k <= 100){
          if(!s.contains(k)){
            resB = k;
            break;
          }
          k++;
        } k <= 100 k 100 {
          if(!s.contains(k)){
            resB = k;
            break;
          }
          k++;
        } if(!s.contains(k)){
            resB = k;
            break;
          } !s.contains(k) s.contains(k) s.contains s k {
            resB = k;
            break;
          } resB = k resB k break; k++ k if(Math.abs(resA) == Math.abs(resB)){
		  if(resA > resB){
            res = resB;
          }else { res = resA;}
        }
      	else if(Math.abs(x - resA) > Math.abs(x - resB)){
          res = resB;
        }else{
          res = resA;
        } Math.abs(resA) == Math.abs(resB) Math.abs(resA) Math.abs Math resA Math.abs(resB) Math.abs Math resB {
		  if(resA > resB){
            res = resB;
          }else { res = resA;}
        } if(resA > resB){
            res = resB;
          }else { res = resA;} resA > resB resA resB {
            res = resB;
          } res = resB res resB { res = resA;} res = resA res resA if(Math.abs(x - resA) > Math.abs(x - resB)){
          res = resB;
        }else{
          res = resA;
        } Math.abs(x - resA) > Math.abs(x - resB) Math.abs(x - resA) Math.abs Math x - resA x resA Math.abs(x - resB) Math.abs Math x - resB x resB {
          res = resB;
        } res = resB res resB {
          res = resA;
        } res = resA res resA System.out.println(res) System.out.println System.out System System.out res String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int N = sc.nextInt();
      	int res = 0;

       if(N == 0){
         System.out.println(x); 
         return;
       }
      
      	//set
        Set<Integer> s = new HashSet<Integer>();     
        for (int i=0; i<N; i++) {
            int p = sc.nextInt();
          s.add(p);
        }        
      	//while x 0
      	int t = x;
      	int resA = 0;
      	while(t > 0){
          if(!s.contains(t)){
            resA = t;
            break;
          }
          t--;
        }
      
      	//while x 100
        int k = x;
        int resB = 101;
      	while(k <= 100){
          if(!s.contains(k)){
            resB = k;
            break;
          }
          k++;
        }

      	if(Math.abs(resA) == Math.abs(resB)){
		  if(resA > resB){
            res = resB;
          }else { res = resA;}
        }
      	else if(Math.abs(x - resA) > Math.abs(x - resB)){
          res = resB;
        }else{
          res = resA;
        }
        //System.out.println(resA+" "+resB);

        System.out.println(res);
    }
}