import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    c();
  }

  public static void c() {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    c();
  }

  public static void c() {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  }
} Main public static void main(String[] args) {
    c();
  } main {
    c();
  } c() c String[] args args public static void c() {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  } c {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  } try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    } catch (Exception E) {
      System.out.println("エラー");
    } Exception E {
      System.out.println("エラー");
    } System.out.println("エラー") System.out.println System.out System System.out "エラー" {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int x = Integer.parseInt(sc.next()); x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int y = Integer.parseInt(sc.next()); y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Integer[] a = new Integer[y]; a new Integer[y] y for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      } int z = 0; int z = 0; z 0 z < y z y z++ z++ z {
        a[z] = Integer.parseInt(sc.next());
      } {
        a[z] = Integer.parseInt(sc.next());
      } a[z] = Integer.parseInt(sc.next()) a[z] a z Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Boolean flg = true; flg true if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      } !Arrays.asList(a).contains(x) Arrays.asList(a).contains(x) Arrays.asList(a).contains Arrays.asList(a) Arrays.asList Arrays a x {
        System.out.println(x);
        flg = false;
      } System.out.println(x) System.out.println System.out System System.out x flg = false flg false int ans = 0; ans 0 if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      } flg {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      } for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        } int q = 1; int q = 1; q 1 q < y + 2 q y + 2 y 2 q++ q++ q {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        } {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        } ans = x - q ans x - q x q if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          } !Arrays.asList(a).contains(ans) Arrays.asList(a).contains(ans) Arrays.asList(a).contains Arrays.asList(a) Arrays.asList Arrays a ans {
            System.out.println(ans);
            break;
          } System.out.println(ans) System.out.println System.out System System.out ans break; ans = x + q ans x + q x q if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          } !Arrays.asList(a).contains(ans) Arrays.asList(a).contains(ans) Arrays.asList(a).contains Arrays.asList(a) Arrays.asList Arrays a ans {
            System.out.println(ans);
            break;
          } System.out.println(ans) System.out.println System.out System System.out ans break; public class Main {
  public static void main(String[] args) {
    c();
  }

  public static void c() {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  }
} public class Main {
  public static void main(String[] args) {
    c();
  }

  public static void c() {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    c();
  }

  public static void c() {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  }
}