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();
    int p[] = new int[n];
    int s[] = new int[n];
    if(n==0){
      System.out.println(x);
      return;
    }
    for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    }
    
    Arrays.sort(p);
    
    int ue_s = 0;
    int st_s = 0;
    int ue_ans = 0;
    int st_ans = 0;
    

    //うえ
    for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    }

    //した
    for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    }
    ue_s = Math.abs(x-ue_ans);
    st_s = Math.abs(x-st_ans);
    if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans);
    
  }
} 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();
    int p[] = new int[n];
    int s[] = new int[n];
    if(n==0){
      System.out.println(x);
      return;
    }
    for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    }
    
    Arrays.sort(p);
    
    int ue_s = 0;
    int st_s = 0;
    int ue_ans = 0;
    int st_ans = 0;
    

    //うえ
    for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    }

    //した
    for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    }
    ue_s = Math.abs(x-ue_ans);
    st_s = Math.abs(x-st_ans);
    if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans);
    
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    int p[] = new int[n];
    int s[] = new int[n];
    if(n==0){
      System.out.println(x);
      return;
    }
    for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    }
    
    Arrays.sort(p);
    
    int ue_s = 0;
    int st_s = 0;
    int ue_ans = 0;
    int st_ans = 0;
    

    //うえ
    for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    }

    //した
    for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    }
    ue_s = Math.abs(x-ue_ans);
    st_s = Math.abs(x-st_ans);
    if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans);
    
  } main {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    int p[] = new int[n];
    int s[] = new int[n];
    if(n==0){
      System.out.println(x);
      return;
    }
    for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    }
    
    Arrays.sort(p);
    
    int ue_s = 0;
    int st_s = 0;
    int ue_ans = 0;
    int st_ans = 0;
    

    //うえ
    for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    }

    //した
    for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    }
    ue_s = Math.abs(x-ue_ans);
    st_s = Math.abs(x-st_ans);
    if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans);
    
  } 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 p[] = new int[n]; p new int[n] n int s[] = new int[n]; s new int[n] n 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; for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    } int i = 0 ; int i = 0 ; i 0 i < n i n ++i ++i i {
      p[i] = sc.nextInt();      
    } {
      p[i] = sc.nextInt();      
    } p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc Arrays.sort(p) Arrays.sort Arrays p int ue_s = 0; ue_s 0 int st_s = 0; st_s 0 int ue_ans = 0; ue_ans 0 int st_ans = 0; st_ans 0 for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    } int i = x ; int i = x ; i x i <= 101 i 101 ++i ++i i {
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    } {
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    } int count=0; count 0 for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      } int j = 0 ; int j = 0 ; j 0 j < n j n ++j ++j j {   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      } {   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      } if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        } p[j] != i p[j] p j i {
          count++; 
        } count++ count if(p[j] == i){
          break;
        } p[j] == i p[j] p j i {
          break;
        } break; if(count == p.length){
        ue_ans = i;
        break;
      } count == p.length count p.length p p.length {
        ue_ans = i;
        break;
      } ue_ans = i ue_ans i break; for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    } int i = x ; int i = x ; i x i >= 0 i 0 --i --i i {
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    } {
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    } int count=0; count 0 for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      } int j = 0 ; int j = 0 ; j 0 j < n j n ++j ++j j {
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      } {
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      } if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        } p[j] != i p[j] p j i {
          count++; 
        } count++ count if(p[j] == i){
          break;
        } p[j] == i p[j] p j i {
          break;
        } break; if(count == p.length){
        st_ans = i;
        break;
      } count == p.length count p.length p p.length {
        st_ans = i;
        break;
      } st_ans = i st_ans i break; ue_s = Math.abs(x-ue_ans) ue_s Math.abs(x-ue_ans) Math.abs Math x-ue_ans x ue_ans st_s = Math.abs(x-st_ans) st_s Math.abs(x-st_ans) Math.abs Math x-st_ans x st_ans if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans); ue_s<st_s ue_s st_s System.out.println(ue_ans) System.out.println System.out System System.out ue_ans System.out.println(st_ans) System.out.println System.out System System.out st_ans 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 p[] = new int[n];
    int s[] = new int[n];
    if(n==0){
      System.out.println(x);
      return;
    }
    for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    }
    
    Arrays.sort(p);
    
    int ue_s = 0;
    int st_s = 0;
    int ue_ans = 0;
    int st_ans = 0;
    

    //うえ
    for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    }

    //した
    for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    }
    ue_s = Math.abs(x-ue_ans);
    st_s = Math.abs(x-st_ans);
    if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans);
    
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    int p[] = new int[n];
    int s[] = new int[n];
    if(n==0){
      System.out.println(x);
      return;
    }
    for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    }
    
    Arrays.sort(p);
    
    int ue_s = 0;
    int st_s = 0;
    int ue_ans = 0;
    int st_ans = 0;
    

    //うえ
    for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    }

    //した
    for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    }
    ue_s = Math.abs(x-ue_ans);
    st_s = Math.abs(x-st_ans);
    if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans);
    
  }
} 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();
    int p[] = new int[n];
    int s[] = new int[n];
    if(n==0){
      System.out.println(x);
      return;
    }
    for(int i = 0 ; i < n ; ++i){
      p[i] = sc.nextInt();      
    }
    
    Arrays.sort(p);
    
    int ue_s = 0;
    int st_s = 0;
    int ue_ans = 0;
    int st_ans = 0;
    

    //うえ
    for(int i = x ; i <= 101 ; ++i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){   
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        ue_ans = i;
        break;
      }
    }

    //した
    for(int i = x ; i >= 0 ; --i){
      int count=0;
      for(int j = 0 ; j < n ; ++j){
        if(p[j] != i){
          count++; 
        }else if(p[j] == i){
          break;
        }
      }if(count == p.length){
        st_ans = i;
        break;
      }
    }
    ue_s = Math.abs(x-ue_ans);
    st_s = Math.abs(x-st_ans);
    if(ue_s<st_s) System.out.println(ue_ans);
    else System.out.println(st_ans);
    
  }
}