import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int x=Integer.parseInt(str[0]);
        int n=Integer.parseInt(str[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<=101;i++)
        ts.add(i);
        str=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i])));
        int t1=ts.floor(x);
        int t2=ts.ceiling(x);
        if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2));
        pw.flush();
        pw.close();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int x=Integer.parseInt(str[0]);
        int n=Integer.parseInt(str[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<=101;i++)
        ts.add(i);
        str=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i])));
        int t1=ts.floor(x);
        int t2=ts.ceiling(x);
        if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2));
        pw.flush();
        pw.close();
    }
} Main public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int x=Integer.parseInt(str[0]);
        int n=Integer.parseInt(str[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<=101;i++)
        ts.add(i);
        str=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i])));
        int t1=ts.floor(x);
        int t2=ts.ceiling(x);
        if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2));
        pw.flush();
        pw.close();
    } main {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int x=Integer.parseInt(str[0]);
        int n=Integer.parseInt(str[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<=101;i++)
        ts.add(i);
        str=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i])));
        int t1=ts.floor(x);
        int t2=ts.ceiling(x);
        if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2));
        pw.flush();
        pw.close();
    } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter pw=new PrintWriter(System.out); pw new PrintWriter(System.out) String str[]=br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " 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 TreeSet<Integer> ts=new TreeSet<>(); ts new TreeSet<>() for(int i=0;i<=101;i++)
        ts.add(i); int i=0; int i=0; i 0 i<=101 i 101 i++ i++ i ts.add(i); ts.add(i) ts.add ts i str=br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i]))); int i=0; int i=0; i 0 i<n i n i++ i++ i ts.remove(new Integer(Integer.parseInt(str[i]))); ts.remove(new Integer(Integer.parseInt(str[i]))) ts.remove ts new Integer(Integer.parseInt(str[i])) int t1=ts.floor(x); t1 ts.floor(x) ts.floor ts x int t2=ts.ceiling(x); t2 ts.ceiling(x) ts.ceiling ts x if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2)); (int)Math.abs(t1-x)<(int)Math.abs(t2-x) (int)Math.abs(t1-x) Math.abs Math t1-x t1 x (int)Math.abs(t2-x) Math.abs Math t2-x t2 x pw.println(t1) pw.println pw t1 if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2)); (int)Math.abs(t1-x)>(int)Math.abs(t2-x) (int)Math.abs(t1-x) Math.abs Math t1-x t1 x (int)Math.abs(t2-x) Math.abs Math t2-x t2 x pw.println(t2) pw.println pw t2 pw.println(Math.min(t1,t2)) pw.println pw Math.min(t1,t2) Math.min Math t1 t2 pw.flush() pw.flush pw pw.close() pw.close pw String args[] args public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int x=Integer.parseInt(str[0]);
        int n=Integer.parseInt(str[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<=101;i++)
        ts.add(i);
        str=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i])));
        int t1=ts.floor(x);
        int t2=ts.ceiling(x);
        if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2));
        pw.flush();
        pw.close();
    }
} public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int x=Integer.parseInt(str[0]);
        int n=Integer.parseInt(str[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<=101;i++)
        ts.add(i);
        str=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i])));
        int t1=ts.floor(x);
        int t2=ts.ceiling(x);
        if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2));
        pw.flush();
        pw.close();
    }
} Main
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int x=Integer.parseInt(str[0]);
        int n=Integer.parseInt(str[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0;i<=101;i++)
        ts.add(i);
        str=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        ts.remove(new Integer(Integer.parseInt(str[i])));
        int t1=ts.floor(x);
        int t2=ts.ceiling(x);
        if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
        pw.println(t1);
        else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
        pw.println(t2);
        else
        pw.println(Math.min(t1,t2));
        pw.flush();
        pw.close();
    }
}