import java.util.*;
 
public class Main {
  public static void main(String[] args ) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> forbidden = new ArrayList<Integer>();
    int X = sc.nextInt();
    int f = sc.nextInt();
    for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    }
   
    int i = 0;
    int tf = 1;
	
    for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    }
    
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args ) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> forbidden = new ArrayList<Integer>();
    int X = sc.nextInt();
    int f = sc.nextInt();
    for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    }
   
    int i = 0;
    int tf = 1;
	
    for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    }
    
  }
} Main public static void main(String[] args ) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> forbidden = new ArrayList<Integer>();
    int X = sc.nextInt();
    int f = sc.nextInt();
    for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    }
   
    int i = 0;
    int tf = 1;
	
    for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    }
    
  } main {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> forbidden = new ArrayList<Integer>();
    int X = sc.nextInt();
    int f = sc.nextInt();
    for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    }
   
    int i = 0;
    int tf = 1;
	
    for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    }
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> forbidden = new ArrayList<Integer>(); forbidden new ArrayList<Integer>() int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int f = sc.nextInt(); f sc.nextInt() sc.nextInt sc for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    } int i=0; int i=0; i 0 i<f i f i++ i++ i {
      int j = sc.nextInt();
      forbidden.add(j);
    } {
      int j = sc.nextInt();
      forbidden.add(j);
    } int j = sc.nextInt(); j sc.nextInt() sc.nextInt sc forbidden.add(j) forbidden.add forbidden j int i = 0; i 0 int tf = 1; tf 1 for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    } int h=0; int h=0; h 0 h<100 h 100 h++ h++ h {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    } {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    } for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } int j=0; int j=0; j 0 j<f j f j++ j++ j {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (forbidden.get(j) == X-i) {
              tf = 0;
            } forbidden.get(j) == X-i forbidden.get(j) forbidden.get forbidden j X-i X i {
              tf = 0;
            } tf = 0 tf 0 if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        } tf == 1 tf 1 {
          System.out.println(X-i);
          break;
        } System.out.println(X-i) System.out.println System.out System System.out X-i X i break; {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        } tf = 1 tf 1 for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } int k=0; int k=0; k 0 k<f k f k++ k++ k {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (forbidden.get(k) == X+i) {
              tf = 0;
            } forbidden.get(k) == X+i forbidden.get(k) forbidden.get forbidden k X+i X i {
              tf = 0;
            } tf = 0 tf 0 if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          } tf == 1 tf 1 {
            System.out.println(X+i);
            break;
          } System.out.println(X+i) System.out.println System.out System System.out X+i X i break; {
            i = i+1;
            tf = 1;
          } i = i+1 i i+1 i 1 tf = 1 tf 1 String[] args args public class Main {
  public static void main(String[] args ) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> forbidden = new ArrayList<Integer>();
    int X = sc.nextInt();
    int f = sc.nextInt();
    for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    }
   
    int i = 0;
    int tf = 1;
	
    for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    }
    
  }
} public class Main {
  public static void main(String[] args ) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> forbidden = new ArrayList<Integer>();
    int X = sc.nextInt();
    int f = sc.nextInt();
    for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    }
   
    int i = 0;
    int tf = 1;
	
    for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    }
    
  }
} Main
import java.util.*;
 
public class Main {
  public static void main(String[] args ) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> forbidden = new ArrayList<Integer>();
    int X = sc.nextInt();
    int f = sc.nextInt();
    for (int i=0;i<f;i++) {
      int j = sc.nextInt();
      forbidden.add(j);
    }
   
    int i = 0;
    int tf = 1;
	
    for (int h=0; h<100; h++) {
        for (int j=0;j<f;j++) {
            if (forbidden.get(j) == X-i) {
              tf = 0;
            }
        } if (tf == 1) {
          System.out.println(X-i);
          break;
        } else {
          tf = 1;
          for (int k=0;k<f;k++) {
            if (forbidden.get(k) == X+i) {
              tf = 0;
            }
          } if (tf == 1) {
            System.out.println(X+i);
            break;
          } else {
            i = i+1;
            tf = 1;
          }
        }
    }
    
  }
}