
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  }

} import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  }

} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  } main {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] str1 = sc.nextLine().split(" "); str1 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " String[] str2 = sc.nextLine().split(" "); str2 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int x = Integer.parseInt(str1[0]); x Integer.parseInt(str1[0]) Integer.parseInt Integer str1[0] str1 0 int n = Integer.parseInt(str1[1]); n Integer.parseInt(str1[1]) Integer.parseInt Integer str1[1] str1 1 int index = x; index x int[] num = new int[102]; num new int[102] 102 for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    } int i = 0 ; int i = 0 ; i 0 i < 102 i 102 i++ i++ i {
      num[i] = i;
    } {
      num[i] = i;
    } num[i] = i num[i] num i i for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      num[Integer.parseInt(str2[i])] = -1;
    } {
      num[Integer.parseInt(str2[i])] = -1;
    } num[Integer.parseInt(str2[i])] = -1 num[Integer.parseInt(str2[i])] num Integer.parseInt(str2[i]) Integer.parseInt Integer str2[i] str2 i -1 1 int minIndex = -1; minIndex -1 1 int maxIndex = -1; maxIndex -1 1 for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    } int i = 0 ; int i = 0 ; i 0 i < 102 i 102 i++ i++ i {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    } {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    } if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      } i < index i index {
        if(num[i] != -1) {
          minIndex = i;
        }
      } if(num[i] != -1) {
          minIndex = i;
        } num[i] != -1 num[i] num i -1 1 {
          minIndex = i;
        } minIndex = i minIndex i {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      } if(num[i] != -1) {
          maxIndex = i;
          break;
        } num[i] != -1 num[i] num i -1 1 {
          maxIndex = i;
          break;
        } maxIndex = i maxIndex i break; int ans = 0; ans 0 if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    } minIndex != -1 && maxIndex != -1 minIndex != -1 minIndex -1 1 maxIndex != -1 maxIndex -1 1 {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    } if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      } x - num[minIndex] <= num[maxIndex] - x x - num[minIndex] x num[minIndex] num minIndex num[maxIndex] - x num[maxIndex] num maxIndex x {
        ans = num[minIndex];
      } ans = num[minIndex] ans num[minIndex] num minIndex {
        ans = num[maxIndex];
      } ans = num[maxIndex] ans num[maxIndex] num maxIndex if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    } minIndex != -1 && maxIndex == -1 minIndex != -1 minIndex -1 1 maxIndex == -1 maxIndex -1 1 {
      ans = num[minIndex];
    } ans = num[minIndex] ans num[minIndex] num minIndex {
      ans = num[maxIndex];
    } ans = num[maxIndex] ans num[maxIndex] num maxIndex System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  }

} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  }

} Main

import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  }

}
