import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Set;
import java.util.HashSet;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    str = in.readLine().split(" ");
    Set<Integer> set = new HashSet<>();
    for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    }
    for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.Set; Set java.util import java.util.HashSet; HashSet java.util public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    str = in.readLine().split(" ");
    Set<Integer> set = new HashSet<>();
    for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    }
    for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    }
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    str = in.readLine().split(" ");
    Set<Integer> set = new HashSet<>();
    for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    }
    for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    }
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    str = in.readLine().split(" ");
    Set<Integer> set = new HashSet<>();
    for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    }
    for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    }
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String[] str = in.readLine().split(" "); str in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int x = Integer.parseInt(str[0]); x Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int n = Integer.parseInt(str[1]); n Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 str = in.readLine().split(" ") str in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " Set<Integer> set = new HashSet<>(); set new HashSet<>() for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      set.add(Integer.parseInt(str[i]));
    } {
      set.add(Integer.parseInt(str[i]));
    } set.add(Integer.parseInt(str[i])) set.add set Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    } int i=0; int i=0; i 0 i<=200 i 200 i++ i++ i {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    } {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    } if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      } !set.contains(x-i) set.contains(x-i) set.contains set x-i x i {
        System.out.println(x-i);
        return;
      } System.out.println(x-i) System.out.println System.out System System.out x-i x i return; if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      } !set.contains(x+i) set.contains(x+i) set.contains set x+i x i {
        System.out.println(x+i);
        return;
      } System.out.println(x+i) System.out.println System.out System System.out x+i x i return; String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    str = in.readLine().split(" ");
    Set<Integer> set = new HashSet<>();
    for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    }
    for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    }
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    str = in.readLine().split(" ");
    Set<Integer> set = new HashSet<>();
    for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    }
    for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    }
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Set;
import java.util.HashSet;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int x = Integer.parseInt(str[0]);
    int n = Integer.parseInt(str[1]);
    str = in.readLine().split(" ");
    Set<Integer> set = new HashSet<>();
    for(int i=0; i<n; i++) {
      set.add(Integer.parseInt(str[i]));
    }
    for(int i=0; i<=200; i++) {
      if(!set.contains(x-i)) {
        System.out.println(x-i);
        return;
      }
      if(!set.contains(x+i)) {
        System.out.println(x+i);
        return;
      }
    }
  }
}