import java.util.*;
public class Main  {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      
      if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      }
   }
} import java.util.*; util.* java public class Main  {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      
      if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      }
   }
} Main public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      
      if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      }
   } main {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      
      if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      }
   } 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 if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      } n == 0 n 0 {
         System.out.println(x);
      } System.out.println(x) System.out.println System.out System System.out x {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      } int a[] = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int aa = sc.nextInt();
            a[i] = aa;
         } {
            int aa = sc.nextInt();
            a[i] = aa;
         } int aa = sc.nextInt(); aa sc.nextInt() sc.nextInt sc a[i] = aa a[i] a i aa int b[] = new int[102]; b new int[102] 102 for (int j = 0; j < 102; j++) {
            b[j] = 0;
         } int j = 0; int j = 0; j 0 j < 102 j 102 j++ j++ j {
            b[j] = 0;
         } {
            b[j] = 0;
         } b[j] = 0 b[j] b j 0 for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
            int aaa = a[k];
            b[aaa] = 1;
         } {
            int aaa = a[k];
            b[aaa] = 1;
         } int aaa = a[k]; aaa a[k] a k b[aaa] = 1 b[aaa] b aaa 1 if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         } b[x] == 0 b[x] b x 0 {
            System.out.println(x);
         } System.out.println(x) System.out.println System.out System System.out x {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         } int fin = 0; fin 0 int count = 1; count 1 while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            } fin == 0 fin 0 {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            } if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               } b[x-count] == 0 b[x-count] b x-count x count 0 {
                  System.out.println(x-count);
                  fin++;
               } System.out.println(x-count) System.out.println System.out System System.out x-count x count fin++ fin if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               } fin == 0 && 101 >= x + count &&  b[x + count] == 0 fin == 0 && 101 >= x + count &&  b[x + count] == 0 fin == 0 fin 0 101 >= x + count 101 x + count x count b[x + count] == 0 b[x + count] b x + count x count 0 {
                  System.out.println(x+count);
                  fin++;
               } System.out.println(x+count) System.out.println System.out System System.out x+count x count fin++ fin count++ count 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();
      
      if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      }
   }
} public class Main  {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      
      if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      }
   }
} Main
import java.util.*;
public class Main  {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      
      if (n == 0) {
         System.out.println(x);
      } else {
         int a[] = new int[n];

         for (int i = 0; i < n; i++) {
            int aa = sc.nextInt();
            a[i] = aa;
         }
            
         int b[] = new int[102];
      
         for (int j = 0; j < 102; j++) {
            b[j] = 0;
         }
      
         for (int k = 0; k < n; k++) {
            int aaa = a[k];
            b[aaa] = 1;
         }
      
         if (b[x] == 0) {
            System.out.println(x);
         } else {
            int fin = 0;
            int count = 1;
            while (fin == 0) {
               if (b[x-count] == 0) {
                  System.out.println(x-count);
                  fin++;
               } else if (fin == 0 && 101 >= x + count &&  b[x + count] == 0) {
                  System.out.println(x+count);
                  fin++;
               }
               count++;
            }
         }
      }
   }
}