import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    List<Integer> listPlus = new ArrayList<>();
    List<Integer> listMinus = new ArrayList<>();

    for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    }
    int plusX = 0;
    for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    }
    int minusX = -101;
    for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    }
    int abs = Math.abs(minusX);
    if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    }
  }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner 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();
    List<Integer> listPlus = new ArrayList<>();
    List<Integer> listMinus = new ArrayList<>();

    for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    }
    int plusX = 0;
    for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    }
    int minusX = -101;
    for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    }
    int abs = Math.abs(minusX);
    if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    List<Integer> listPlus = new ArrayList<>();
    List<Integer> listMinus = new ArrayList<>();

    for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    }
    int plusX = 0;
    for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    }
    int minusX = -101;
    for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    }
    int abs = Math.abs(minusX);
    if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    List<Integer> listPlus = new ArrayList<>();
    List<Integer> listMinus = new ArrayList<>();

    for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    }
    int plusX = 0;
    for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    }
    int minusX = -101;
    for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    }
    int abs = Math.abs(minusX);
    if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    }
  } 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 List<Integer> listPlus = new ArrayList<>(); listPlus new ArrayList<>() List<Integer> listMinus = new ArrayList<>(); listMinus new ArrayList<>() for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    } {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    } int pi = sc.nextInt(); pi sc.nextInt() sc.nextInt sc int xpi = pi - x; xpi pi - x pi x if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      } xpi >= 0 xpi 0 {
        listPlus.add(xpi);
      } listPlus.add(xpi) listPlus.add listPlus xpi {
        listMinus.add(xpi);
      } listMinus.add(xpi) listMinus.add listMinus xpi int plusX = 0; plusX 0 for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    } int i = 0; int i = 0; i 0 i < 101 i 101 i++ i++ i {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    } {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    } boolean check1 = true; check1 true for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      } Integer plus listPlus {
        if (i == plus) {
          check1 = false;
        }
      } {
        if (i == plus) {
          check1 = false;
        }
      } if (i == plus) {
          check1 = false;
        } i == plus i plus {
          check1 = false;
        } check1 = false check1 false if (check1) {
        plusX = i;
        break;
      } check1 {
        plusX = i;
        break;
      } plusX = i plusX i break; int minusX = -101; minusX -101 101 for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    } int i = -1; int i = -1; i -1 1 i > -101 i -101 101 i-- i-- i {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    } {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    } boolean check1 = true; check1 true for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      } Integer minus listMinus {
        if (i == minus) {
          check1 = false;
        }
      } {
        if (i == minus) {
          check1 = false;
        }
      } if (i == minus) {
          check1 = false;
        } i == minus i minus {
          check1 = false;
        } check1 = false check1 false if (check1) {
        minusX = i;
        break;
      } check1 {
        minusX = i;
        break;
      } minusX = i minusX i break; int abs = Math.abs(minusX); abs Math.abs(minusX) Math.abs Math minusX if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    } plusX == abs plusX abs {
      System.out.println(x + minusX);
    } System.out.println(x + minusX) System.out.println System.out System System.out x + minusX x minusX if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    } plusX > abs plusX abs {
      System.out.println(x + minusX);
    } System.out.println(x + minusX) System.out.println System.out System System.out x + minusX x minusX {
      System.out.println(x + plusX);
    } System.out.println(x + plusX) System.out.println System.out System System.out x + plusX x plusX 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();
    List<Integer> listPlus = new ArrayList<>();
    List<Integer> listMinus = new ArrayList<>();

    for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    }
    int plusX = 0;
    for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    }
    int minusX = -101;
    for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    }
    int abs = Math.abs(minusX);
    if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    List<Integer> listPlus = new ArrayList<>();
    List<Integer> listMinus = new ArrayList<>();

    for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    }
    int plusX = 0;
    for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    }
    int minusX = -101;
    for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    }
    int abs = Math.abs(minusX);
    if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    }
  }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    List<Integer> listPlus = new ArrayList<>();
    List<Integer> listMinus = new ArrayList<>();

    for (int i = 0; i < n; i++) {
      int pi = sc.nextInt();
      int xpi = pi - x;
      if (xpi >= 0) {
        listPlus.add(xpi);
      } else {
        listMinus.add(xpi);
      }
    }
    int plusX = 0;
    for (int i = 0; i < 101; i++) {
      boolean check1 = true;
      for (Integer plus : listPlus) {
        if (i == plus) {
          check1 = false;
        }
      }
      if (check1) {
        plusX = i;
        break;
      }
    }
    int minusX = -101;
    for (int i = -1; i > -101; i--) {
      boolean check1 = true;
      for (Integer minus : listMinus) {
        if (i == minus) {
          check1 = false;
        }
      }
      if (check1) {
        minusX = i;
        break;
      }
    }
    int abs = Math.abs(minusX);
    if (plusX == abs) {
      System.out.println(x + minusX);
    } else if (plusX > abs) {
      System.out.println(x + minusX);
    } else {
      System.out.println(x + plusX);
    }
  }
}
