import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> p = new ArrayList<Integer>();
    boolean f = true;
    if(n == 0) f = false;

    for(int i=0; i<n; i++) {
      int tmp = sc.nextInt();
      p.add(tmp);
    }

    Collections.sort(p);
    int ans = 101;
    for(int i=0; i<102; i++) {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    }

    if(f = true) {
      if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      }
    } else {
      System.out.println(x);
    }

	}
} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> p = new ArrayList<Integer>();
    boolean f = true;
    if(n == 0) f = false;

    for(int i=0; i<n; i++) {
      int tmp = sc.nextInt();
      p.add(tmp);
    }

    Collections.sort(p);
    int ans = 101;
    for(int i=0; i<102; i++) {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    }

    if(f = true) {
      if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      }
    } else {
      System.out.println(x);
    }

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> p = new ArrayList<Integer>();
    boolean f = true;
    if(n == 0) f = false;

    for(int i=0; i<n; i++) {
      int tmp = sc.nextInt();
      p.add(tmp);
    }

    Collections.sort(p);
    int ans = 101;
    for(int i=0; i<102; i++) {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    }

    if(f = true) {
      if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      }
    } else {
      System.out.println(x);
    }

	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> p = new ArrayList<Integer>();
    boolean f = true;
    if(n == 0) f = false;

    for(int i=0; i<n; i++) {
      int tmp = sc.nextInt();
      p.add(tmp);
    }

    Collections.sort(p);
    int ans = 101;
    for(int i=0; i<102; i++) {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    }

    if(f = true) {
      if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      }
    } else {
      System.out.println(x);
    }

	} 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 ArrayList<Integer> p = new ArrayList<Integer>(); p new ArrayList<Integer>() boolean f = true; f true if(n == 0) f = false; n == 0 n 0 f = false f false for(int i=0; i<n; i++) {
      int tmp = sc.nextInt();
      p.add(tmp);
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      int tmp = sc.nextInt();
      p.add(tmp);
    } {
      int tmp = sc.nextInt();
      p.add(tmp);
    } int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc p.add(tmp) p.add p tmp Collections.sort(p) Collections.sort Collections p int ans = 101; ans 101 for(int i=0; i<102; i++) {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    } int i=0; int i=0; i 0 i<102 i 102 i++ i++ i {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    } {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    } if(p.contains(i)) continue; p.contains(i) p.contains p i continue; ans = Math.min(ans, Math.abs(x-i)) ans Math.min(ans, Math.abs(x-i)) Math.min Math ans Math.abs(x-i) Math.abs Math x-i x i if(f = true) {
      if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      }
    } else {
      System.out.println(x);
    } f = true f true {
      if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      }
    } if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      } p.contains(x-ans) p.contains p x-ans x ans {
        System.out.println(x+ans);
      } System.out.println(x+ans) System.out.println System.out System System.out x+ans x ans {
        System.out.println(x-ans);
      } System.out.println(x-ans) System.out.println System.out System System.out x-ans x ans {
      System.out.println(x);
    } System.out.println(x) System.out.println System.out System System.out x String[] args args
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> p = new ArrayList<Integer>();
    boolean f = true;
    if(n == 0) f = false;

    for(int i=0; i<n; i++) {
      int tmp = sc.nextInt();
      p.add(tmp);
    }

    Collections.sort(p);
    int ans = 101;
    for(int i=0; i<102; i++) {
      if(p.contains(i)) continue;
      //System.out.println(Math.abs(x-i));
      ans = Math.min(ans, Math.abs(x-i));
      //System.out.println(ans);
    }

    if(f = true) {
      if(p.contains(x-ans)) {
        System.out.println(x+ans);
      } else {
        System.out.println(x-ans);
      }
    } else {
      System.out.println(x);
    }

	}
}
