import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
      int X = scan.nextInt();
      int N = scan.nextInt();
      int pn[] = new int[N];
      for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      }
      int ans1 = X;
      int ans2 = X;
      int x = X;
      
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      }
      x = X;
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      }
      
      if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1);
   }
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
      int X = scan.nextInt();
      int N = scan.nextInt();
      int pn[] = new int[N];
      for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      }
      int ans1 = X;
      int ans2 = X;
      int x = X;
      
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      }
      x = X;
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      }
      
      if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1);
   }
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
      int X = scan.nextInt();
      int N = scan.nextInt();
      int pn[] = new int[N];
      for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      }
      int ans1 = X;
      int ans2 = X;
      int x = X;
      
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      }
      x = X;
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      }
      
      if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1);
   } main {
		Scanner scan = new Scanner(System.in);
      int X = scan.nextInt();
      int N = scan.nextInt();
      int pn[] = new int[N];
      for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      }
      int ans1 = X;
      int ans2 = X;
      int x = X;
      
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      }
      x = X;
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      }
      
      if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1);
   } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int X = scan.nextInt(); X scan.nextInt() scan.nextInt scan int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int pn[] = new int[N]; pn new int[N] N for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      } int i=0; int i=0; i 0 i<N i N i++ i++ i {
        pn[i] = scan.nextInt();
      } {
        pn[i] = scan.nextInt();
      } pn[i] = scan.nextInt() pn[i] pn i scan.nextInt() scan.nextInt scan int ans1 = X; ans1 X int ans2 = X; ans2 X int x = X; x X while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      } true {
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      } for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        } {
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        } if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x; x == pn[i] x pn[i] pn i {
             ans1 = 200;
             break;
           } ans1 = 200 ans1 200 break; ans1 = x ans1 x if(ans1 == x)
          break; ans1 == x ans1 x break; x -= 1 x 1 x = X x X while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      } true {
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      } for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        } {
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        } if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x; x == pn[i] x pn[i] pn i {
             ans2 = 200;
             break;
           } ans2 = 200 ans2 200 break; ans2 = x ans2 x if(ans2 == x)
          break; ans2 == x ans2 x break; x += 1 x 1 if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1); X-ans1 > ans2-X X-ans1 X ans1 ans2-X ans2 X System.out.println(ans2) System.out.println System.out System System.out ans2 System.out.println(ans1) System.out.println System.out System System.out ans1 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
      int X = scan.nextInt();
      int N = scan.nextInt();
      int pn[] = new int[N];
      for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      }
      int ans1 = X;
      int ans2 = X;
      int x = X;
      
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      }
      x = X;
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      }
      
      if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1);
   }
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
      int X = scan.nextInt();
      int N = scan.nextInt();
      int pn[] = new int[N];
      for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      }
      int ans1 = X;
      int ans2 = X;
      int x = X;
      
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      }
      x = X;
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      }
      
      if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1);
   }
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
      int X = scan.nextInt();
      int N = scan.nextInt();
      int pn[] = new int[N];
      for(int i=0; i<N; i++){
        pn[i] = scan.nextInt();
      }
      int ans1 = X;
      int ans2 = X;
      int x = X;
      
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans1 = 200;
             break;
           }else
             ans1 = x;
        }
        if(ans1 == x)
          break;
        x -= 1;
      }
      x = X;
      while(true){
        for(int i=0; i<N; i++){
           if(x == pn[i]){
             ans2 = 200;
             break;
           }else
             ans2 = x;
        }
        if(ans2 == x)
          break;
        x += 1;
      }
      
      if(X-ans1 > ans2-X)
        System.out.println(ans2);
      else
        System.out.println(ans1);
   }
}