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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashSet; HashSet java.util public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int x = Integer.parseInt(s[0]); x Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int n = Integer.parseInt(s[1]); n Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 if(n == 0) {
            System.out.print(x);
            return;
        } n == 0 n 0 {
            System.out.print(x);
            return;
        } System.out.print(x) System.out.print System.out System System.out x return; s = br.readLine().split(" ") s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " HashSet<Integer> set = new HashSet<>(); set new HashSet<>() for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i])); int i=0; int i=0; i 0 i<n i n i++ i++ i set.add(Integer.parseInt(s[i])); set.add(Integer.parseInt(s[i])) set.add set Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i if(!set.contains(x)) {
            System.out.print(x);
            return;
        } !set.contains(x) set.contains(x) set.contains set x {
            System.out.print(x);
            return;
        } System.out.print(x) System.out.print System.out System System.out x return; int nearest = 1; nearest 1 while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        } true {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        } if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            } !set.contains(x-nearest) set.contains(x-nearest) set.contains set x-nearest x nearest {
                System.out.print(x-nearest);
                return;
            } System.out.print(x-nearest) System.out.print System.out System System.out x-nearest x nearest return; if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            } !set.contains(x+nearest) set.contains(x+nearest) set.contains set x+nearest x nearest {
                System.out.print(x+nearest);
                return;
            } System.out.print(x+nearest) System.out.print System.out System System.out x+nearest x nearest return; nearest++ nearest String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    }
}