
import java.io.*;
import java.util.*;
import java.math.*;

public class Main { 
    
    public static void main(String[] args) throws java.lang.Exception { 
        Reader pm =new Reader(); 
        //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;
        while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        }
        //end of tests
        
    }
    //end of main class

    static int countInRange(int arr[], int n, int x, int y) { 
        // initialize result 
        int count = 0; 
        count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1; 
        return count; 
    } 
    
    
    static int lowerIndex(int arr[], int n, int x) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } 
        return l; 
    } 
      
    // function to find last index <= y 
    static int upperIndex(int arr[], int n, int y) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } 
        return h; 
    }
    
    public static StringBuilder dec_to_bin(long n) {
        // decimal to binary upto 30 binaries
        if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        }
        StringBuilder str=new StringBuilder("");
        while(n!=0) {
            str.append(n%2L);
            n/=2L;
        }
        str=str.reverse();
        StringBuilder tmp_str=new StringBuilder("");
        int len=str.length();
        while(len!=30) {
            tmp_str.append("0");
            len++;
        }
        tmp_str.append(str);
        return tmp_str;
    }
    
    private static int binarySearchPM(int[] arr, int key){
        int n = arr.length;
        int mid = -1;
        int begin = 0,end=n;
        while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        }
        //System.out.println(begin+" "+end);
        return -begin; //expected Index
    }
    
    static class Reader { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    }
}     import java.io.*; io.* java import java.util.*; util.* java import java.math.*; math.* java public class Main { 
    
    public static void main(String[] args) throws java.lang.Exception { 
        Reader pm =new Reader(); 
        //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;
        while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        }
        //end of tests
        
    }
    //end of main class

    static int countInRange(int arr[], int n, int x, int y) { 
        // initialize result 
        int count = 0; 
        count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1; 
        return count; 
    } 
    
    
    static int lowerIndex(int arr[], int n, int x) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } 
        return l; 
    } 
      
    // function to find last index <= y 
    static int upperIndex(int arr[], int n, int y) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } 
        return h; 
    }
    
    public static StringBuilder dec_to_bin(long n) {
        // decimal to binary upto 30 binaries
        if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        }
        StringBuilder str=new StringBuilder("");
        while(n!=0) {
            str.append(n%2L);
            n/=2L;
        }
        str=str.reverse();
        StringBuilder tmp_str=new StringBuilder("");
        int len=str.length();
        while(len!=30) {
            tmp_str.append("0");
            len++;
        }
        tmp_str.append(str);
        return tmp_str;
    }
    
    private static int binarySearchPM(int[] arr, int key){
        int n = arr.length;
        int mid = -1;
        int begin = 0,end=n;
        while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        }
        //System.out.println(begin+" "+end);
        return -begin; //expected Index
    }
    
    static class Reader { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    }
} Main public static void main(String[] args) throws java.lang.Exception { 
        Reader pm =new Reader(); 
        //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;
        while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        }
        //end of tests
        
    } main { 
        Reader pm =new Reader(); 
        //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;
        while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        }
        //end of tests
        
    } Reader pm =new Reader(); pm new Reader() int t = 1; t 1 while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        } t-- > 0 t-- t 0 {
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        } int x = pm.nextInt(); x pm.nextInt() pm.nextInt pm int n = pm.nextInt(); n pm.nextInt() pm.nextInt pm int[] a = new int[n]; a new int[n] n ArrayList<Integer> al = new ArrayList(); al new ArrayList() HashSet<Integer> hs = new HashSet<>(); hs new HashSet<>() for(int i=1;i<=100;i++)
                hs.add(i); int i=1; int i=1; i 1 i<=100 i 100 i++ i++ i hs.add(i); hs.add(i) hs.add hs i for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            } int i=0; int i=0; i 0 i<n i n i++ i++ i {
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            } {
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            } a[i] = pm.nextInt() a[i] a i pm.nextInt() pm.nextInt pm hs.remove((Integer)a[i]) hs.remove hs (Integer)a[i] a i int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE int dif = Integer.MAX_VALUE; dif Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            } int i hs {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            } {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            } int df = Math.abs(i-x); df Math.abs(i-x) Math.abs Math i-x i x dif = Math.min(dif,df) dif Math.min(dif,df) Math.min Math dif df TreeSet<Integer> ts = new TreeSet<>(); ts new TreeSet<>() for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            } int i hs {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            } {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            } int df = Math.abs(i-x); df Math.abs(i-x) Math.abs Math i-x i x if(df == dif) 
                    ts.add(i); df == dif df dif ts.add(i) ts.add ts i int on = Math.abs(x); on Math.abs(x) Math.abs Math x int off = Math.abs(x-101); off Math.abs(x-101) Math.abs Math x-101 x 101 int mh = Math.min(on, off); mh Math.min(on, off) Math.min Math on off if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } mh <= dif && mh == on mh <= dif mh dif mh == on mh on {
                if(mh == on)
                    System.out.println(0);
                return;
            } if(mh == on)
                    System.out.println(0); mh == on mh on System.out.println(0) System.out.println System.out System System.out 0 return; if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            } mh < dif && mh == off mh < dif mh dif mh == off mh off {
                System.out.println(101);
                return;
            } System.out.println(101) System.out.println System.out System System.out 101 return; if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            } hs.size() == 0 hs.size() hs.size hs 0 {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            } int min = Math.min(Math.abs(x), Math.abs(x-101)); min Math.min(Math.abs(x), Math.abs(x-101)) Math.min Math Math.abs(x) Math.abs Math x Math.abs(x-101) Math.abs Math x-101 x 101 System.out.println(min) System.out.println System.out System System.out min return; System.out.println(ts.first()) System.out.println System.out System System.out ts.first() ts.first ts String[] args args static int countInRange(int arr[], int n, int x, int y) { 
        // initialize result 
        int count = 0; 
        count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1; 
        return count; 
    } countInRange { 
        // initialize result 
        int count = 0; 
        count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1; 
        return count; 
    } int count = 0; count 0 count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1 count upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1 upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) upperIndex(arr, n, y) upperIndex arr n y lowerIndex(arr, n, x) lowerIndex arr n x 1 return count; count int arr[] arr int n n int x x int y y static int lowerIndex(int arr[], int n, int x) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } 
        return l; 
    } lowerIndex { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } 
        return l; 
    } int l = 0 l 0 h = n - 1; h n - 1 n 1 while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } l <= h l h { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } int mid = (l + h) / 2; mid (l + h) / 2 (l + h) l h 2 if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; arr[mid] >= x arr[mid] arr mid x h = mid - 1 h mid - 1 mid 1 l = mid + 1 l mid + 1 mid 1 return l; l int arr[] arr int n n int x x // function to find last index <= y 
    static int upperIndex(int arr[], int n, int y) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } 
        return h; 
    } upperIndex { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } 
        return h; 
    } int l = 0 l 0 h = n - 1; h n - 1 n 1 while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } l <= h l h { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } int mid = (l + h) / 2; mid (l + h) / 2 (l + h) l h 2 if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; arr[mid] <= y arr[mid] arr mid y l = mid + 1 l mid + 1 mid 1 h = mid - 1 h mid - 1 mid 1 return h; h int arr[] arr int n n int y y public static StringBuilder dec_to_bin(long n) {
        // decimal to binary upto 30 binaries
        if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        }
        StringBuilder str=new StringBuilder("");
        while(n!=0) {
            str.append(n%2L);
            n/=2L;
        }
        str=str.reverse();
        StringBuilder tmp_str=new StringBuilder("");
        int len=str.length();
        while(len!=30) {
            tmp_str.append("0");
            len++;
        }
        tmp_str.append(str);
        return tmp_str;
    } dec_to_bin {
        // decimal to binary upto 30 binaries
        if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        }
        StringBuilder str=new StringBuilder("");
        while(n!=0) {
            str.append(n%2L);
            n/=2L;
        }
        str=str.reverse();
        StringBuilder tmp_str=new StringBuilder("");
        int len=str.length();
        while(len!=30) {
            tmp_str.append("0");
            len++;
        }
        tmp_str.append(str);
        return tmp_str;
    } if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        } n==0 n 0 {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        } StringBuilder str=new StringBuilder(""); str new StringBuilder("") for(int i=0;i<30;i++) {
                str.append("0");
            } int i=0; int i=0; i 0 i<30 i 30 i++ i++ i {
                str.append("0");
            } {
                str.append("0");
            } str.append("0") str.append str "0" return str; str StringBuilder str=new StringBuilder(""); str new StringBuilder("") while(n!=0) {
            str.append(n%2L);
            n/=2L;
        } n!=0 n 0 {
            str.append(n%2L);
            n/=2L;
        } str.append(n%2L) str.append str n%2L n 2L n/=2L n 2L str=str.reverse() str str.reverse() str.reverse str StringBuilder tmp_str=new StringBuilder(""); tmp_str new StringBuilder("") int len=str.length(); len str.length() str.length str while(len!=30) {
            tmp_str.append("0");
            len++;
        } len!=30 len 30 {
            tmp_str.append("0");
            len++;
        } tmp_str.append("0") tmp_str.append tmp_str "0" len++ len tmp_str.append(str) tmp_str.append tmp_str str return tmp_str; tmp_str long n n private static int binarySearchPM(int[] arr, int key){
        int n = arr.length;
        int mid = -1;
        int begin = 0,end=n;
        while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        }
        //System.out.println(begin+" "+end);
        return -begin; //expected Index
    } binarySearchPM {
        int n = arr.length;
        int mid = -1;
        int begin = 0,end=n;
        while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        }
        //System.out.println(begin+" "+end);
        return -begin; //expected Index
    } int n = arr.length; n arr.length arr arr.length int mid = -1; mid -1 1 int begin = 0 begin 0 end=n; end n while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        } begin <= end begin end {
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        } mid = (begin+end) / 2 mid (begin+end) / 2 (begin+end) begin end 2 if(mid == n){
                return n;
            } mid == n mid n {
                return n;
            } return n; n if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            } key < arr[mid] key arr[mid] arr mid {
                end = mid-1;
            } end = mid-1 end mid-1 mid 1 if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            } key > arr[mid] key arr[mid] arr mid {
                begin = mid+1;
            } begin = mid+1 begin mid+1 mid 1 {
                return mid;
            } return mid; mid return -begin; //expected Index -begin begin int[] arr arr int key key static class Reader { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    } Reader final private int BUFFER_SIZE = 1 << 16; BUFFER_SIZE 1 << 16 1 16 private DataInputStream din; din private byte[] buffer; buffer private int bufferPointer bufferPointer bytesRead; bytesRead public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } Reader { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } din = new DataInputStream(System.in) din new DataInputStream(System.in) buffer = new byte[BUFFER_SIZE] buffer new byte[BUFFER_SIZE] BUFFER_SIZE bufferPointer = bytesRead = 0 bufferPointer bytesRead = 0 bytesRead 0 public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } Reader { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } din = new DataInputStream(new FileInputStream(file_name)) din new DataInputStream(new FileInputStream(file_name)) buffer = new byte[BUFFER_SIZE] buffer new byte[BUFFER_SIZE] BUFFER_SIZE bufferPointer = bytesRead = 0 bufferPointer bytesRead = 0 bytesRead 0 String file_name file_name public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } readLine { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } byte[] buf = new byte[64]; buf new byte[64] 64 int cnt = 0 cnt 0 c; c while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } (c = read()) != -1 (c = read()) c read() read -1 1 { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } if (c == '\n') 
                    break; c == '\n' c '\n' break; buf[cnt++] = (byte) c buf[cnt++] buf cnt++ cnt (byte) c return new String(buf, 0, cnt); new String(buf, 0, cnt) public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } nextInt { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } int ret = 0; ret 0 byte c = read(); c read() read while (c <= ' ') 
                c = read(); c <= ' ' c ' ' c = read() c read() read boolean neg = (c == '-'); neg (c == '-') c '-' if (neg) 
                c = read(); neg c = read() c read() read do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' { 
                ret = ret * 10 + c - '0'; 
            } ret = ret * 10 + c - '0' ret ret * 10 + c - '0' ret * 10 + c ret * 10 ret 10 c '0' if (neg) 
                return -ret; neg return -ret; -ret ret return ret; ret public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } nextLong { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } long ret = 0; ret 0 byte c = read(); c read() read while (c <= ' ') 
                c = read(); c <= ' ' c ' ' c = read() c read() read boolean neg = (c == '-'); neg (c == '-') c '-' if (neg) 
                c = read(); neg c = read() c read() read do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' { 
                ret = ret * 10 + c - '0'; 
            } ret = ret * 10 + c - '0' ret ret * 10 + c - '0' ret * 10 + c ret * 10 ret 10 c '0' if (neg) 
                return -ret; neg return -ret; -ret ret return ret; ret public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } nextDouble { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } double ret = 0 ret 0 div = 1; div 1 byte c = read(); c read() read while (c <= ' ') 
                c = read(); c <= ' ' c ' ' c = read() c read() read boolean neg = (c == '-'); neg (c == '-') c '-' if (neg) 
                c = read(); neg c = read() c read() read do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' { 
                ret = ret * 10 + c - '0'; 
            } ret = ret * 10 + c - '0' ret ret * 10 + c - '0' ret * 10 + c ret * 10 ret 10 c '0' if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } c == '.' c '.' { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' { 
                    ret += (c - '0') / (div *= 10); 
                } ret += (c - '0') / (div *= 10) ret (c - '0') / (div *= 10) (c - '0') c '0' (div *= 10) div 10 if (neg) 
                return -ret; neg return -ret; -ret ret return ret; ret private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } fillBuffer { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE) bytesRead din.read(buffer, bufferPointer = 0, BUFFER_SIZE) din.read din buffer bufferPointer = 0 bufferPointer 0 BUFFER_SIZE if (bytesRead == -1) 
                buffer[0] = -1; bytesRead == -1 bytesRead -1 1 buffer[0] = -1 buffer[0] buffer 0 -1 1 private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } read { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } if (bufferPointer == bytesRead) 
                fillBuffer(); bufferPointer == bytesRead bufferPointer bytesRead fillBuffer() fillBuffer return buffer[bufferPointer++]; buffer[bufferPointer++] buffer bufferPointer++ bufferPointer public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } close { 
            if (din == null) 
                return; 
            din.close(); 
        } if (din == null) 
                return; din == null din null return; din.close() din.close din public class Main { 
    
    public static void main(String[] args) throws java.lang.Exception { 
        Reader pm =new Reader(); 
        //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;
        while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        }
        //end of tests
        
    }
    //end of main class

    static int countInRange(int arr[], int n, int x, int y) { 
        // initialize result 
        int count = 0; 
        count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1; 
        return count; 
    } 
    
    
    static int lowerIndex(int arr[], int n, int x) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } 
        return l; 
    } 
      
    // function to find last index <= y 
    static int upperIndex(int arr[], int n, int y) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } 
        return h; 
    }
    
    public static StringBuilder dec_to_bin(long n) {
        // decimal to binary upto 30 binaries
        if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        }
        StringBuilder str=new StringBuilder("");
        while(n!=0) {
            str.append(n%2L);
            n/=2L;
        }
        str=str.reverse();
        StringBuilder tmp_str=new StringBuilder("");
        int len=str.length();
        while(len!=30) {
            tmp_str.append("0");
            len++;
        }
        tmp_str.append(str);
        return tmp_str;
    }
    
    private static int binarySearchPM(int[] arr, int key){
        int n = arr.length;
        int mid = -1;
        int begin = 0,end=n;
        while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        }
        //System.out.println(begin+" "+end);
        return -begin; //expected Index
    }
    
    static class Reader { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    }
} public class Main { 
    
    public static void main(String[] args) throws java.lang.Exception { 
        Reader pm =new Reader(); 
        //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;
        while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        }
        //end of tests
        
    }
    //end of main class

    static int countInRange(int arr[], int n, int x, int y) { 
        // initialize result 
        int count = 0; 
        count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1; 
        return count; 
    } 
    
    
    static int lowerIndex(int arr[], int n, int x) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } 
        return l; 
    } 
      
    // function to find last index <= y 
    static int upperIndex(int arr[], int n, int y) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } 
        return h; 
    }
    
    public static StringBuilder dec_to_bin(long n) {
        // decimal to binary upto 30 binaries
        if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        }
        StringBuilder str=new StringBuilder("");
        while(n!=0) {
            str.append(n%2L);
            n/=2L;
        }
        str=str.reverse();
        StringBuilder tmp_str=new StringBuilder("");
        int len=str.length();
        while(len!=30) {
            tmp_str.append("0");
            len++;
        }
        tmp_str.append(str);
        return tmp_str;
    }
    
    private static int binarySearchPM(int[] arr, int key){
        int n = arr.length;
        int mid = -1;
        int begin = 0,end=n;
        while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        }
        //System.out.println(begin+" "+end);
        return -begin; //expected Index
    }
    
    static class Reader { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    }
} Main

import java.io.*;
import java.util.*;
import java.math.*;

public class Main { 
    
    public static void main(String[] args) throws java.lang.Exception { 
        Reader pm =new Reader(); 
        //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;
        while(t-- > 0){
            int x = pm.nextInt();
            int n = pm.nextInt();
            int[] a = new int[n];
            ArrayList<Integer> al = new ArrayList();
            HashSet<Integer> hs = new HashSet<>();
            for(int i=1;i<=100;i++)
                hs.add(i);
            for(int i=0;i<n;i++){
                a[i] = pm.nextInt();
                hs.remove((Integer)a[i]);
            }
            //System.out.println(hs);
            int ans = Integer.MAX_VALUE;
            int dif = Integer.MAX_VALUE;
            for(int i:hs) {

                int df = Math.abs(i-x);
                dif = Math.min(dif,df);
            }
            TreeSet<Integer> ts = new TreeSet<>();
            for(int i : hs) {
                int df = Math.abs(i-x);
                if(df == dif) 
                    ts.add(i);
            }
            int on = Math.abs(x);
            int off = Math.abs(x-101);
            int mh = Math.min(on, off);

            if(mh <= dif && mh == on) {
                if(mh == on)
                    System.out.println(0);
                return;
            } 
            if(mh < dif && mh == off) {
                System.out.println(101);
                return;
            }
            if(hs.size() == 0) {
                int min = Math.min(Math.abs(x), Math.abs(x-101));
                System.out.println(min);
                return;
            }
            System.out.println(ts.first());
        }
        //end of tests
        
    }
    //end of main class

    static int countInRange(int arr[], int n, int x, int y) { 
        // initialize result 
        int count = 0; 
        count = upperIndex(arr, n, y) -  
                lowerIndex(arr, n, x) + 1; 
        return count; 
    } 
    
    
    static int lowerIndex(int arr[], int n, int x) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] >= x) 
                h = mid - 1; 
            else
                l = mid + 1; 
        } 
        return l; 
    } 
      
    // function to find last index <= y 
    static int upperIndex(int arr[], int n, int y) { 
        int l = 0, h = n - 1; 
        while (l <= h)  
        { 
            int mid = (l + h) / 2; 
            if (arr[mid] <= y) 
                l = mid + 1; 
            else
                h = mid - 1; 
        } 
        return h; 
    }
    
    public static StringBuilder dec_to_bin(long n) {
        // decimal to binary upto 30 binaries
        if(n==0) {
            StringBuilder str=new StringBuilder("");
            for(int i=0;i<30;i++) {
                str.append("0");
            }
            return str;
        }
        StringBuilder str=new StringBuilder("");
        while(n!=0) {
            str.append(n%2L);
            n/=2L;
        }
        str=str.reverse();
        StringBuilder tmp_str=new StringBuilder("");
        int len=str.length();
        while(len!=30) {
            tmp_str.append("0");
            len++;
        }
        tmp_str.append(str);
        return tmp_str;
    }
    
    private static int binarySearchPM(int[] arr, int key){
        int n = arr.length;
        int mid = -1;
        int begin = 0,end=n;
        while(begin <= end){
            mid = (begin+end) / 2;
            if(mid == n){
                return n;
            }
            if(key < arr[mid]){
                end = mid-1;
            } else if(key > arr[mid]){
                begin = mid+1;
            } else {
                return mid;
            }
        }
        //System.out.println(begin+" "+end);
        return -begin; //expected Index
    }
    
    static class Reader { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    }
}    