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();
    boolean[] line = new boolean[105];
    for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    }

    int pointerLeft = x;
    int pointerRight = x;
    while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    }
  }
} 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();
    boolean[] line = new boolean[105];
    for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    }

    int pointerLeft = x;
    int pointerRight = x;
    while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    boolean[] line = new boolean[105];
    for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    }

    int pointerLeft = x;
    int pointerRight = x;
    while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    boolean[] line = new boolean[105];
    for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    }

    int pointerLeft = x;
    int pointerRight = x;
    while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    }
  } 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 boolean[] line = new boolean[105]; line new boolean[105] 105 for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      line[sc.nextInt()] = true;
    } {
      line[sc.nextInt()] = true;
    } line[sc.nextInt()] = true line[sc.nextInt()] line sc.nextInt() sc.nextInt sc true int pointerLeft = x; pointerLeft x int pointerRight = x; pointerRight x while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    } true {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    } if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      } line[pointerLeft] == false line[pointerLeft] line pointerLeft false {
        System.out.println(pointerLeft);
        break;
      } System.out.println(pointerLeft) System.out.println System.out System System.out pointerLeft break; if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      } line[pointerRight] == false line[pointerRight] line pointerRight false {
        System.out.println(pointerRight);
        break;
      } System.out.println(pointerRight) System.out.println System.out System System.out pointerRight break; pointerLeft-- pointerLeft pointerRight++ pointerRight 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();
    boolean[] line = new boolean[105];
    for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    }

    int pointerLeft = x;
    int pointerRight = x;
    while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    boolean[] line = new boolean[105];
    for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    }

    int pointerLeft = x;
    int pointerRight = x;
    while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    }
  }
} 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();
    boolean[] line = new boolean[105];
    for (int i = 0; i < n; i++) {
      line[sc.nextInt()] = true;
    }

    int pointerLeft = x;
    int pointerRight = x;
    while (true) {
      if (line[pointerLeft] == false) {
        System.out.println(pointerLeft);
        break;
      } else if (line[pointerRight] == false) {
        System.out.println(pointerRight);
        break;
      }
      pointerLeft--;
      pointerRight++;
    }
  }
}
